#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(vector<T> &A) {
  for_each(A.begin(), A.end(), [&](T &i) { cin >> i; });
}
template <typename T>
inline void print(const vector<T> &A, const string &sep = " ",
                  const string &delim = "\n") {
  for_each(A.begin(), A.end(), [&](const T &i) { cout << i << sep; });
  cout << delim;
}
const size_t MOD = 1e9 + 7;
const size_t MAXA = 1e9;
const size_t MAXN = 2 * 1e5 + 1;
const double delta = 0.000001;
long long N;
string S, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> S;
  ans = S;
  for (int o = 0; o < 10; o++) {
    string A(N, ' ');
    for (int i = 0; i < N; i++) A[i] = (((S[i] - '0') + o) % 10) + '0';
    for (int i = 0; i < N; i++) {
      bool smaller = false;
      for (int l = 0; l < N; l++) {
        auto x = (i + l) % N;
        if (A[x] != ans[l]) {
          smaller = (A[x] < ans[l]);
          break;
        }
      }
      if (!smaller) continue;
      for (int l = 0; l < N; l++) {
        auto x = (i + l) % N;
        ans[l] = A[x];
      }
      while (i < N) {
        if (A[i] != A[i + 1]) break;
        i++;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
