#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  string in, out;
  cin >> n;
  cin >> in;
  for (i = 0; i < in.length(); i++) out += '9';
  for (j = 0; j < in.length(); j++) {
    string s;
    int x = (10 - (in[j] - '0')) % 10;
    for (i = j; i != (j - 1 + in.length()) % in.length();
         i = (i + 1) % in.length())
      s += ((in[i] - '0' + x) % 10 + '0');
    s += ((in[i] - '0' + x) % 10 + '0');
    if (s < out) out = s;
  }
  cout << out << endl;
  return 0;
}
