#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 10010;
int main() {
  string s;
  int n, i, j, k;
  cin >> n >> s;
  string ss = s;
  for (i = 0; i < n; i++) {
    int cha = s[0] - '0';
    for (j = 0; j < n; j++) {
      s[j] = (s[j] - '0' + 10 - cha) % 10 + '0';
    }
    if (ss > s) {
      ss = s;
    }
    char c = s[0];
    for (j = 1; j < n; j++) s[j - 1] = s[j];
    s[n - 1] = c;
  }
  cout << ss;
}
