#include <bits/stdc++.h>
using namespace std;
int a[2005];
char c[2005], s[2005];
int main() {
  int i, j, n, t, b;
  while (scanf("%d", &n) != -1) {
    scanf("%s", c);
    for (i = 1; i <= n; i++) {
      a[i] = c[i - 1] - '0';
      a[n + i] = a[i];
    }
    for (i = 1; i <= n; i++) {
      t = 10 - a[i];
      t %= 10;
      for (j = 0; j < n; j++) {
        b = a[i + j] + t;
        b %= 10;
        s[j] = b + '0';
      }
      s[n] = '\0';
      if (strcmp(c, s) > 0) strcpy(c, s);
    }
    printf("%s\n", c);
  }
  return 0;
}
