#include <bits/stdc++.h>
using namespace std;
long long g(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return g(b, a % b);
}
char s1[1000010], s2[1010], s3[1010];
int main() {
  int n, i, j, l, dff, k;
  cin >> n >> s1;
  l = strlen(s1);
  strcat(s1, s1);
  for (i = 0; i < 1; i++) {
    if (s1[i] == '0')
      dff = 0;
    else
      dff = 10 - (s1[i] - '0');
    for (k = i; k < i + l; k++) {
      s3[k - i] = ((s1[k] - '0' + dff) % 10) + '0';
    }
    s3[k] = '\0';
  }
  for (i = 1; i < l; i++) {
    if (s1[i] == '0')
      dff = 0;
    else
      dff = 10 - (s1[i] - '0');
    for (k = i; k < i + l; k++) {
      s2[k - i] = ((s1[k] - '0' + dff) % 10) + '0';
    }
    s2[k] = '\0';
    if (strcmp(s2, s3) < 0) strcpy(s3, s2);
  }
  cout << s3 << "\n";
  return 0;
}
