#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s, ans;     cin >> s;     ans = s;     s += s;     for (int k = 0; k < 10; k++) {       for (int i = 0; i < s.length(); i++) {         s[i]++;         if (s[i] >  9 ) s[i] =  0 ;       }       for (int i = 0; i < n; i++) {         ans = min(ans, s.substr(i, n));       }     }     cout << ans << endl;     return 0;   }   