#include <bits/stdc++.h>
using namespace std;
const int N = 1100;
char st1[N], st2[N], S[N];
int main() {
  int n;
  cin >> n >> st1;
  for (int i = 0; i < n; ++i) S[i] = st1[i];
  for (int i = 0; i < n; ++i) {
    int k = (10 - (st1[i] - '0')) % 10;
    int flag = 1;
    int pos = i;
    for (int j = 0; j < n; ++j) {
      st2[j] = ((st1[pos] - '0') + k) % 10 + '0';
      pos = (pos + 1) % n;
    }
    for (k = 0; k < n; ++k) {
      if (S[k] > st2[k]) {
        for (int k = 0; k < n; ++k) S[k] = st2[k];
        break;
      } else if (S[k] < st2[k])
        break;
    }
  }
  cout << S << endl;
  return 0;
}
