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.io.*;
import java.util.*;

public class A {
    public static void main(String args[]) throws Exception {
        Reader reader = new Reader();
        reader.initConsoleReading();
        int len = reader.nextInt();
        String text = reader.next();
        Set<String> set = new TreeSet<>();
        for (int i = 0; i < len; i++) {
            if (text.charAt(i) == '0') set.add(getMin(text, i));
            else set.add(getMin(shift(text, text.charAt(i)), i));
        }
        System.out.println(((TreeSet<String>) set).first());
        reader.dispose();

    }

    private static String shift(String text, char charAt) {
        int d = 10 - (charAt - '0');
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < text.length(); i++) {
            char ch = (char) (((text.charAt(i) - '0' + d) % 10) + '0');
            sb.append(ch);
        }
        return sb.toString();
    }

    private static String getMin(String text, int p) {
        return text.substring(p) + text.substring(0, p);
    }


    /************************************Helper Methods Begin Here**********************************************/
    private static String reverse(String toRev) {
        return new StringBuilder(toRev).reverse().toString();
    }

    public static class Pair<F extends Comparable<F>, S extends Comparable<S>> implements Comparable<Pair<F, S>> {
        static final int prime = 31;
        private F first;
        private S second;

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

        @Override
        public int hashCode() {
            int result = 1;
            result = prime * result + this.first.hashCode();
            result = prime * result + this.second.hashCode();
            return result;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)
                return false;
            if (getClass() != obj.getClass())
                return false;
            Pair<F, S> s = (Pair<F, S>) obj;
            return this.first.equals(s.first) && this.second.equals(s.second);
        }

        @Override
        public int compareTo(Pair<F, S> p) {
            int c1 = this.first.compareTo(p.first);
            if (c1 == 0) {
                return this.second.compareTo(p.second);
            }
            return c1;
        }
    }

    public static int swap(int a, int b) {
        /*a = Main.swap(b,b=a); goes from left to right*/
        return a;
    }

    public static long swap(long a, long b) {
        /*a = Main.swap(b,b=a); goes from left to right*/
        return a;
    }

    private static <T1, T2> void init6d(T1[][][][][][] sixD, T2 val) {
        for (T1[][][][][] fiveD : sixD) init5d(fiveD, val);
    }

    private static <T1, T2> void init5d(T1[][][][][] fiveD, T2 val) {
        for (T1[][][][] fourD : fiveD) init4d(fourD, val);
    }

    private static <T1, T2> void init4d(T1[][][][] fourD, T2 val) {
        for (T1[][][] threeD : fourD) init3d(threeD, val);
    }

    private static <T1, T2> void init3d(T1[][][] threeD, T2 val) {
        for (T1[][] twoD : threeD) init2d(twoD, val);
    }

    private static <T1, T2> void init2d(T1[][] twoD, T2 val) {
        for (T1[] oneD : twoD) init1d(oneD, val);
    }

    private static <T1, T2> void init1d(T1[] oneD, T2 val) {
        Arrays.fill(oneD, val);
    }

    public static boolean next_permutation(int[] p) {
        for (int a = p.length - 2; a >= 0; --a)
            if (p[a] < p[a + 1])
                for (int b = p.length - 1; ; --b)
                    if (p[b] > p[a]) {
                        int t = p[a];
                        p[a] = p[b];
                        p[b] = t;
                        for (++a, b = p.length - 1; a < b; ++a, --b) {
                            t = p[a];
                            p[a] = p[b];
                            p[b] = t;
                        }
                        return true;
                    }
        return false;
    }

    public static long gcd(long a, long b) {
        if (a < 0) a *= -1;
        if (b < 0) b *= -1;
        return b == 0 ? a : gcd(b, a % b);
    }

    public static class Reader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public Reader() {
        }

        public Reader initConsoleReading() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
            return this;
        }

        public Reader initFileReading(String filePath) throws FileNotFoundException {
            reader = new BufferedReader(new FileReader(filePath), 32768);
            tokenizer = null;
            return this;
        }

        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 String nextLine() throws IOException {
            return reader.readLine();
        }

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

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

        public void dispose() throws IOException {
            this.reader.close();
        }
    }
    /************************************Helper Methods Ends Here**********************************************/
}
