#include <bits/stdc++.h>
using namespace std;
string x;
int n;
int main() {
  string ans;
  cin >> n;
  cin >> x;
  ans = x;
  for (int i = 0; i < n; i++) {
    string temp = "";
    int cnt = (10 - (int)(x[i] - '0')) % 10;
    for (int j = 0; j < n; j++)
      temp += (char)(((int)(x[(i + j) % n] - '0' + cnt) % 10) + '0');
    ans = min(ans, temp);
  }
  cout << ans << endl;
  return 0;
}
