#include <bits/stdc++.h>
using namespace std;
int n;
string a, b;
set<string> secret;
int main() {
  cin >> n;
  cin >> a;
  for (int i = 0; i < n; i++) b = b + '0';
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) b[(i + j) % n] = a[j];
    int different = '0' - b[0];
    for (int j = 0; j < n; j++) {
      b[j] = b[j] + different;
      if (b[j] < '0') b[j] = b[j] + 10;
    }
    secret.insert(b);
  }
  cout << *secret.begin();
  return 0;
}
