#include <bits/stdc++.h>
using namespace std;
string s, r;
char p[1234567];
vector<string> v, ans;
int main() {
  int n;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    int temp = s[i] - '0', temp1 = 0, temp2 = 0;
    if (temp > 0) {
      temp = 10 - temp;
    }
    r = s;
    for (int j = 0; j < n; j++) {
      temp1 = temp + (int)(r[j] - '0');
      if (temp1 > 9) temp1 = (temp1) % 10;
      r[j] = '0' + temp1;
    }
    v.push_back(r);
  }
  int c = 0;
  for (int i = 0; i < n; i++) {
    c = 0;
    r = v[i];
    while (c < n) {
      p[c] = r[(c + i) % n];
      c++;
    }
    p[n] = '\0';
    ans.push_back(p);
  }
  sort(ans.begin(), ans.end());
  cout << ans[0] << endl;
  return 0;
}
