#include <bits/stdc++.h>
using namespace std;
long long i, j, k, p, l, e, m, n, c[100000], pas, ans, mx, mn;
string a, b[1010], st, mnst, cch;
int main() {
  cin >> n >> a;
  p = 1;
  l = 0;
  mx = 0;
  for (i = 1; i < n; i++) {
    if (a[i] == a[i - 1])
      p++;
    else {
      if (p == mx) {
        c[l] = i - p;
        l++;
      }
      if (p > mx) {
        l = 1;
        c[0] = i - p;
        mx = p;
      }
      p = 1;
    }
  }
  if (p == mx) {
    c[l] = i - p;
    l++;
  }
  if (p > mx) {
    l = 1;
    c[0] = i - p;
    mx = p;
  }
  p = 1;
  e = -1;
  for (i = 0; i < l; i++) {
    st = a;
    k = 58 - a[c[i]];
    for (j = 0; j < n; j++)
      if (a[j] + k > 57)
        a[j] = a[j] + k - 58 + 48;
      else
        a[j] = a[j] + k;
    k = n - c[i];
    cch = a;
    for (j = 0; j < n; j++)
      if (j + k >= n)
        a[j + k - n] = cch[j];
      else
        a[j + k] = cch[j];
    if (e == -1 || mnst > a) {
      e = 0;
      mnst = a;
    }
    a = st;
  }
  cout << mnst;
}
