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.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;

public class MainTwo {
    static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(System.out);
    static boolean file = false;
    static final int maxn = (int)1e3 + 111;
    static int inf = (int)1e9;
    static int n,k,m,cnt;
    static Integer a[] = new Integer [maxn];
    static String min;
    
    private static void solve() throws Exception {
        n = in.nextInt();
        String s = in.nextToken();
        for (int i=1; i<=n; i++) {
            a[i] = Integer.parseInt(((Character)s.charAt(i-1)).toString());
            min+="99";
        }
        
        for (int i=1; i<=10; i++) {
            String t = move();
            if (min.compareTo(t)>0) {
                min = t;
            }
            add();
        }
        
        out.println(min);
    }   

    private static void add() {
        for (int i=1; i<=n; i++) {
            a[i]=(a[i]+1)%10;
        }
    }

    private static String move() {
        String s = "";
        String loc_min = "";
        for (int i=1; i<=n; i++) {
            s+=a[i].toString();
            loc_min+="9";
        }
        loc_min+="9999";
        for (int i=1; i<=n; i++) {
            s+=a[i].toString();
        }
            
        
        for (int i=0; i<n; i++) {
            String t = s.substring(i,i+n);
            if (loc_min.compareTo(t)>0) {
                loc_min = t;
            }
        }
        return loc_min;
    }

    public static void main (String [] args) throws Exception {
        
        if (file) {
            in = new FastReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter ("output.txt");
        }
        
        solve();
        out.close();
    }

    


}

class Pair implements Comparable<Pair> {
    int x,y;
    
    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
    @Override
    public boolean equals(Object obj) {
        Pair p = (Pair)obj;
        if (p.x == x && p.y==y) return true;
        return false;
    }
    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        return x;
    }
    @Override
    public int compareTo(Pair p) {
        if (x<p.x)return 1;
        else if (x==p.x) return 0;
        else return -1;
    }
    
    
    
    
    
}

class FastReader {
    BufferedReader bf;
    StringTokenizer tk = null;

    public FastReader(BufferedReader bf) {
        this.bf = bf;
    }
    
    public String nextToken () throws Exception {
        if (tk==null || !tk.hasMoreTokens()) {
            tk = new StringTokenizer(bf.readLine());
        }
        return tk.nextToken();
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}