#include <bits/stdc++.h>
using namespace std;
string mn;
void com(const deque<char> &de) {
  string tmp;
  char c = *de.begin();
  for (auto &x : de) {
    tmp.push_back((((x - c) + 10) % 10) + '0');
  }
  mn = min(mn, tmp);
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  deque<char> de;
  mn.assign(n, '9');
  for (int i = 0; i < n; i++) de.push_back(s[i]);
  for (int i = 0; i < n; i++) {
    com(de);
    de.push_front(de.back());
    de.pop_back();
  }
  cout << mn;
}
