#include <bits/stdc++.h>
using namespace std;
char s[1010];
int ans[1010];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  int d = (10 - (s[0] - '0'));
  for (int i = 0; i < n; i++) {
    ans[i] = (s[i] + d - '0') % 10;
  }
  for (int i = 1; i < n; i++) {
    d = (10 - (s[i] - '0'));
    bool cond = false;
    for (int j = 0; j < n; j++) {
      if (cond) {
        ans[j] = (s[(i + j) % n] + d - '0') % 10;
        continue;
      }
      if ((s[(i + j) % n] + d - '0') % 10 < ans[j]) {
        ans[j] = (s[(i + j) % n] + d - '0') % 10;
        cond = true;
      } else if ((s[(i + j) % n] + d - '0') % 10 > ans[j]) {
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
