#include <bits/stdc++.h>
using namespace std;
string make_string(int i, char* num, int diff, int n) {
  string result = "";
  int count = 0;
  int temp;
  while (count < n) {
    temp = (num[i] - 48 + diff) % 10 + 48;
    result += (char)temp;
    i = (i + 1) % n;
    count++;
  }
  return result;
}
int main() {
  int n, diff;
  cin >> n;
  char num[n + 1];
  cin >> num;
  string s1 = "";
  string s2 = "";
  for (int i = 0; i < n; i++) {
    s1 += num[i];
  }
  for (int i = 0; i < n; i++) {
    diff = 10 - (num[i] - 48);
    s2 = make_string(i, num, diff, n);
    if (s1.compare(s2) > 0) {
      s1 = s2;
    }
  }
  cout << s1 << endl;
}
