You got a box with a combination lock. The lock has a display showing n digits. There are two buttons on the box, each button changes digits on the display. You have quickly discovered that the first button adds 1 to all the digits (all digits 9 become digits 0), and the second button shifts all the digits on the display one position to the right (the last digit becomes the first one). For example, if the display is currently showing number 579, then if we push the first button, the display will show 680, and if after that we push the second button, the display will show 068.

You know that the lock will open if the display is showing the smallest possible number that can be obtained by pushing the buttons in some order. The leading zeros are ignored while comparing numbers. Now your task is to find the desired number.

Input

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of digits on the display.

The second line contains n digits — the initial state of the display.

Output

Print a single line containing n digits — the desired state of the display containing the smallest possible number.

Examples

Input

3
579


Output

024


Input

4
2014


Output

0142
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
import java.util.concurrent.*;

public class Main {
    //---------------------------------------------------------------------------
    
    static LinkedList<Character> b;
    static int n;
    
    static void less(LinkedList<Character> a, int x) {
        for (int i = 0; i < n; i++) {
            int y = (a.get(i) - '0' + x) % 10;
            if (y < b.get(i) - '0') {
                b.clear();
                for (int j = 0; j < n; j++) {
                    b.addLast((char)(((a.get(j) - '0' + x) % 10) + '0'));
                }
                return;
            }
            if (y > b.get(i) - '0') {
                return;
            }
        }
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        //-----------------------------------------------------------------------
        n = in.nextInt();
        LinkedList<Character> a = new LinkedList();
        String s = in.next();
        b = new LinkedList();
        for (int i = 0; i < n; i++) {
            b.add('9');
            a.addLast(s.charAt(i));
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 10; j++) {
                less(a, j);
            }
            char x = a.getLast();
            a.removeLast();
            a.addFirst(x);
        }
        for (int i = 0; i < n; i++) {
            out.print(b.get(i));
        }
        out.println();
        //-----------------------------------------------------------------------
        out.close();
    }

    //---------------------------------------------------------------------------
    static void shuffleArray(int[] ar) {
        Random rnd = ThreadLocalRandom.current();
        for (int i = ar.length - 1; i > 0; i--) {
            int index = rnd.nextInt(i + 1);
            int a = ar[index];
            ar[index] = ar[i];
            ar[i] = a;
        }
    }

    static class Pair implements Comparator {

        int first, second;

        public Pair() {

        }

        public Pair(int f, int s) {
            this.first = f;
            this.second = s;
        }

        @Override
        public int compare(Object o1, Object o2) {
            Pair p1 = (Pair) o1;
            Pair p2 = (Pair) o2;
            int ret = Integer.compare(p1.first, p2.first);
            if (ret == 0) {
                ret = Integer.compare(p1.second, p2.second);
            }
            return ret;
        }
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public char[] nextCharArray() {
            return next().toCharArray();
        }

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    String s = reader.readLine();
                    if (s == null) {
                        return false;
                    }
                    tokenizer = new StringTokenizer(s);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return true;
        }

        public void skipLine() {
            try {
                tokenizer = null;
                reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
