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.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

/**
 * Created by ruan0408 on 6/09/15.
 */
public class Main {

    public static void main(String[] args) {

        InputReader reader = new InputReader(System.in);
        int n = reader.readInt();
        String s = reader.readString();
        ArrayList<Integer> x = new ArrayList<>(s.length());

        for (int i = 0; i < s.length(); i++)
            x.add(Integer.parseInt("" + s.charAt(i)));

//        System.out.println(Arrays.toString(x.toArray(new Integer[0])));
//        rotate(x);
//        System.out.println(Arrays.toString(x.toArray(new Integer[0])));
//        add(x);
//        System.out.println(Arrays.toString(x.toArray(new Integer[0])));

//        ArrayList<Integer> a = new ArrayList<>(); a.add(0);a.add(2);a.add(4);
//        ArrayList<Integer> b = new ArrayList<>(); b.add(4);b.add(0);b.add(2);
//        System.out.println(lessThan(a,b));

        ArrayList<Integer> min = null;
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < n; j++) {
                //System.out.println(Arrays.toString(x.toArray(new Integer[0])));
                if (min == null || lessThan(x, min)) {
                    //System.out.println(Arrays.toString(x.toArray(new Integer[0])));
                    min = new ArrayList<>(x);
                }
                rotate(x);
            }
            add(x);
        }
        String res = "";
        for(Integer i : min)
            res += i;
        System.out.println(res);

    }

    public static boolean lessThan(ArrayList<Integer> a, ArrayList<Integer> b) {
        for (int i = 0; i < a.size(); i++) {
            if (a.get(i) < b.get(i)) return true;
            else if(a.get(i) > b.get(i)) return false;
        }
        return false;
    }

    public static void rotate(ArrayList<Integer> x) {
        Integer last = x.remove(x.size()-1);
        x.add(0, last);
    }

    public static void add(ArrayList<Integer> x) {
        for (int i = 0; i < x.size(); i++) x.set(i, (x.get(i)+1)%10);
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }

}

class IOUtils {

    public static int[] readIntArray(InputReader in, int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++)
            array[i] = in.readInt();
        return array;
    }

}
