#include <bits/stdc++.h>
int value(const std::vector<int>& xs, int base, int i) {
  return (xs[(base + i) % xs.size()] + 10 - xs[base]) % 10;
}
bool lt(const std::vector<int>& xs, int a, int b) {
  int N = xs.size();
  for (int i = 0; i < N; ++i) {
    int va = value(xs, a, i), vb = value(xs, b, i);
    if (va != vb) return va < vb;
  }
  return false;
}
int main() {
  int N;
  std::cin >> N;
  std::string s;
  std::cin >> s;
  std::vector<int> xs(N), is(N);
  for (int i = 0; i < N; ++i) xs[i] = s[i] - '0', is[i] = i;
  std::sort(is.begin(), is.end(), [&](int a, int b) { return lt(xs, a, b); });
  for (int i = 0; i < N; ++i) std::cout << value(xs, is[0], i);
  std::cout << '\n';
}
