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
/*
* To change this template, choose Tools | Templates and open the template in
* the editor.
*/

import java.io.*;

import java.util.*;


public class Task extends ASolver {

    int n;
    String originalString;

    public static void main(String[] args) throws IOException {
        Task task = new Task();
        task.init();
        task.readData();
        task.writeData(task.solve());
    }

    @Override
    public void init() {
        super.init();
    }

    @Override
    public boolean readData() {
        try {

            n = nextInt();

            originalString = next();

        } catch (Exception ex) {
            System.out.println(ex.getCause());
            System.out.println(ex.getMessage());
            return false;
        }
        return true;
    }

    public String solve() throws IOException {

        int result = 0;

        List<String> strings = new ArrayList<String>();

        String increased = new String(originalString);
        String minString = shuffle(strings, originalString);

        for (int i = 1; i <= 9; i++) {

            increased = getIncreasedString(increased.toCharArray());
            increased = shuffle(strings, increased);

            if (increased.compareTo(minString) < 0) {
                minString = increased;
            }
        }

        //System.out.println(minString);

        return minString;
    }

    public String shuffle(List<String> list, String string) {

        String shuffled = new String(string);
        String minString = new String(string);

        for (int i = 1; i < n; i++) {

            shuffled = shuffled.charAt(n - 1) + shuffled.substring(0, n - 1);

            if (shuffled.compareTo(minString) < 0) {
                minString = shuffled;
            }
        }

        list.add(minString);
        return minString;
    }

    public String getIncreasedString(char[] chars) {

        for (int i = 0; i < n; i++) {
            if (chars[i] == '9') {
                chars[i] = '0';
            } else {
                chars[i]++;
            }
        }

        return new String(chars);
    }
}

abstract class ASolver {

    protected StringTokenizer tokens;
    protected BufferedReader input;
    protected PrintWriter output;

    public void init() {
        input = new BufferedReader(new InputStreamReader(System.in));
    }

    public abstract boolean readData();

    public void writeData(String result) {
        System.out.println(result);
    }

    public void writeData(int result) {
        System.out.println(result);
    }

    public void writeData(long result) {
        System.out.println(result);
    }

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

    public byte nextByte() throws IOException {
        return Byte.parseByte(next());
    }

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

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

    public String next() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine());
        }
        return tokens.nextToken();
    }

    public String nextPoints() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine(), "\n");
        }
        return tokens.nextToken();
    }

    public long infinityImitator(long a, long b) {
        if (a == Long.MIN_VALUE) {
            return Long.MIN_VALUE;
        } else {
            return a + b;
        }
    }

    public int infinityImitator(int a, int b) {
        if (a == Integer.MIN_VALUE) {
            return Integer.MIN_VALUE;
        } else {
            return a + b;
        }
    }

    /*
     * public long max(long... a) { long result = Long.MIN_VALUE; for (int i =
     * 0; i < a.length; i++) { result = Math.max(result, a[i]); } return result;
     * }
     */
    public int indexMax(int... a) {
        int result = 0;
        int index = -1;
        int length = a.length;
        for (int i = 0; i < length; i++) {
            if (a[i] > result) {
                result = a[i];
                index = i;
            }
        }
        return index;
    }

    public int indexMax(long... a) {
        long result = 0;
        int index = -1;
        int length = a.length;
        for (int i = 0; i < length; i++) {
            if (a[i] > result) {
                result = a[i];
                index = i;
            }
        }
        return index;
    }

    public int max(int... a) {
        int result = Integer.MIN_VALUE;
        for (int i = 0; i < a.length; i++) {
            result = Math.max(result, a[i]);
        }
        return result;
    }

    public long max(long... a) {
        long result = Integer.MIN_VALUE;
        for (int i = 0; i < a.length; i++) {
            result = Math.max(result, a[i]);
        }
        return result;
    }

    public int nod(int[] array) {
        int nod = array[0];

        for (int i = 1; i < array.length; i++) {
            nod = nod(nod, array[i]);
        }

        return nod;
    }

    private int nod(int m, int n) {

        int result = 0;

        if (m == 0) {
            return n;
        }

        if (n == 0) {
            return m;
        }

        if (n == m) {
            return m;
        }

        if (m == 1 || n == 1) {
            return 1;
        }

        int mDel = m % 2;
        int nDel = n % 2;


        if (mDel != 0 && nDel != 0) {
            return nod((Math.max(m, n) - Math.min(m, n)) / 2, Math.min(m, n));
        } else if (mDel == 0 && nDel != 0) {
            return nod(m / 2, n);
        } else if (mDel != 0 && nDel == 0) {
            return nod(m, n / 2);
        } else {
            return 2 * nod(m / 2, n / 2);
        }
    }
}