#include <bits/stdc++.h>
using namespace std;
vector<string> v;
string s;
int n;
int main() {
  cin >> n >> s;
  v.push_back(s);
  for (int i = 0; i < n; i++) {
    string s1 = s;
    if (s[i] != 0) {
      int kl = 10 - (s[i] - 48);
      for (int j = 0; j < n; j++) {
        int zn = s[j] - 48 + kl;
        zn %= 10;
        s1[j] = zn + 48;
      }
    }
    string s2 = "";
    for (int j = i; j < n; j++) s2 += s1[j];
    for (int j = 0; j < i; j++) s2 += s1[j];
    v.push_back(s2);
  }
  sort(v.begin(), v.end());
  cout << v[0] << endl;
  return 0;
}
