#include <bits/stdc++.h>
using namespace std;
char s[1010];
char ch[1010][1010];
int cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    scanf("%s", s);
    for (int i = 0; i < n; i++) {
      int t = s[i] - '0';
      t = 10 - t;
      for (int j = 0; j < n; j++) {
        int tt = (i + j) % n;
        ch[i][j] = (s[tt] - '0' + t) % 10 + '0';
      }
      ch[i][n] = '\0';
    }
    qsort(ch, n, sizeof(ch[0]), cmp);
    printf("%s\n", ch[0]);
  }
  return 0;
}
