#include <iostream>
#include <cstring>
using namespace std;
int main(){
string s = "";
int k;
cin>>k;
cin>>s;
string result = "";
for(int i = s.size() - k; i < s.size() ; i ++ ){
result += s[i];
}
for(int i = 0 ; i < s.size() - k; i++){
result += s[i];
}
cout << result;
return 0;
}
class Solution {
public:
int strStr(string haystack, string needle) {
int n = haystack.size(), m = needle.size();
for (int i = 0; i + m <= n; i++) {
bool flag = true;
for (int j = 0; j < m; j++) {
if (haystack[i + j] != needle[j]) {
flag = false;
break;
}
}
if (flag) {
return i;
}
}
return -1;
}
};