#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string x, ans, a, b;
  cin >> n >> x;
  ans = x;
  for (int i = 0; i < x.size(); i++) {
    int dif = (10 - (x[i] - '0'));
    a = x;
    for (int j = 0; j < n; j++) {
      int aux = (((x[j] - '0') + dif)) % 10;
      a[j] = aux + '0';
    }
    b = x;
    for (int j = 0; j < n; j++) {
      b[j] = a[(i + j) % n];
    }
    ans = min(ans, b);
  }
  cout << ans << endl;
}

### Prompt

Please formulate a CPP solution to the following problem:

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string x, ans, a, b;
  cin >> n >> x;
  ans = x;
  for (int i = 0; i < x.size(); i++) {
    int dif = (10 - (x[i] - '0'));
    a = x;
    for (int j = 0; j < n; j++) {
      int aux = (((x[j] - '0') + dif)) % 10;
      a[j] = aux + '0';
    }
    b = x;
    for (int j = 0; j < n; j++) {
      b[j] = a[(i + j) % n];
    }
    ans = min(ans, b);
  }
  cout << ans << endl;
}

```