#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int maxi = 0;
  int ind = 0;
  string ret = "";
  for (int i = 0; i < n; i++) {
    string temp;
    int d = 10 - (s[i] - 48);
    int j = i;
    int ctr = 0;
    while (ctr < n) {
      ctr++;
      temp += ((s[j] - 48 + d) % 10) + 48;
      j = (j + 1) % s.length();
    }
    if (ret == "")
      ret = temp;
    else if (temp < ret)
      ret = temp;
  }
  cout << ret;
}
