#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  string tmp = s;
  for (int i = 0; i < n; i++) {
    int add = 10 - s[i] % 48;
    string cmp;
    for (int j = i; j < n; j++)
      cmp.push_back((char)((s[j] % 48 + add) % 10 + '0'));
    for (int j = 0; j < i; j++)
      cmp.push_back((char)((s[j] % 48 + add) % 10 + '0'));
    if (cmp < tmp) tmp = cmp;
  }
  cout << tmp;
  return 0;
}
