#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  string minm = s;
  for (int x = 0; x <= 10; x++) {
    string s1 = "";
    for (int i = 0; i < n; i++) {
      s1 += ((s[i] - '0' + x) % 10) + '0';
    }
    for (int j = 0; j < n; j++) {
      char y = s1.back();
      s1.pop_back();
      s1 = y + s1;
      minm = min(minm, s1);
    }
  }
  cout << minm;
}
