#include <bits/stdc++.h>
using namespace std;
int cucl(int a) {
  if (a == 0) return 0;
  if (a == 1) return 9;
  if (a == 2) return 8;
  if (a == 3) return 7;
  if (a == 4) return 6;
  if (a == 5) return 5;
  if (a == 6) return 4;
  if (a == 7) return 3;
  if (a == 8) return 2;
  if (a == 9) return 1;
}
int cmp(vector<int> a, vector<int> b) {
  int i;
  for (i = 0; i < a.size(); i++) {
    if (a[i] != b[i]) break;
  }
  if (i == a.size())
    return 0;
  else
    return a[i] < b[i];
}
int main() {
  int n;
  int mas[1005];
  cin >> n;
  char ch;
  vector<int> res;
  for (int i = 0; i < n; i++) {
    cin >> ch;
    mas[i] = ch - 48;
    res.push_back(mas[i]);
  }
  for (int i = 0; i < n; i++) {
    vector<int> a;
    int b = cucl(mas[i]);
    int j = i;
    do {
      a.push_back((mas[j % n] + b) % 10);
      j++;
    } while (j % n != i);
    if (!cmp(res, a)) res = a;
  }
  for (int i = 0; i < res.size(); i++) {
    cout << res[i];
  }
  cout << endl;
}
