#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    vector<string> v(n);
    for (long long int i = 0; i < n; i++) {
      string t = "";
      long long j = i;
      t += s[j];
      j++;
      j %= n;
      while (j != i) {
        t += s[j];
        j++;
        j %= n;
      }
      v[i] = t;
    }
    for (long long int i = 0; i < n; i++) {
      int x = 58 - v[i][0];
      for (long long int j = 0; j < n; j++)
        v[i][j] = (char)(((int)v[i][j] - 48 + x) % 10 + 48);
    }
    sort((v).begin(), (v).end());
    cout << v[0];
  }
  return 0;
}
