#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 23;
int N;
string s;
int data[10][MAXN];
bool cmp(int bega, int inca, int begb, int incb) {
  for (int i = 0; i < N; ++i) {
    if (data[inca][(bega + i) % N] == data[incb][(begb + i) % N])
      continue;
    else
      return data[inca][(bega + i) % N] < data[incb][(begb + i) % N];
  }
  return false;
}
int main() {
  cin >> N;
  cin >> s;
  for (int i = 0; i < N; ++i) {
    int oper = s[i] - '0';
    for (int j = 0; j < 10; ++j) data[j][i] = (oper + j) % 10;
  }
  int maxbeg = 0, maxinc = 0;
  for (int i = 0; i < N; ++i) {
    int inc = (10 - data[0][i]) % 10;
    if (cmp(i, inc, maxbeg, maxinc)) maxbeg = i, maxinc = inc;
  }
  for (int i = 0; i < N; ++i) cout << data[maxinc][(maxbeg + i) % N];
  cout << endl;
  return 0;
}
