#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v1;
vector<int> v2;
int arr[1003];
int main() {
  string s;
  int n, d;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    arr[i] = s[i] - '0';
  }
  for (int i = 0; i < n; i++) {
    v2.clear();
    d = (10 - arr[i]) % 10;
    v2.push_back(0);
    for (int j = (i + 1) % n; j != i; j = (j + 1) % n) {
      v2.push_back((arr[j] + d) % 10);
    }
    v1.push_back(v2);
  }
  sort(v1.begin(), v1.end());
  for (int i = 0; i < n; i++) {
    cout << v1[0][i];
  }
  cout << endl;
}
