#include <bits/stdc++.h>   using namespace std;   long long powmod(long long a, long long b) {     long long res = 1;     a %= 1000000007;     for (; b; b >>= 1) {       if (b & 1) res = res * a % 1000000007;       a = a * a % 1000000007;     }     return res;   }   template <typename T>   inline bool chkmin(T &a, const T &b) {     return a > b ? a = b, 1 : 0;   }   template <typename T>   inline bool chkmax(T &a, const T &b) {     return a < b ? a = b, 1 : 0;   }   int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   const int P = 10000007;   unsigned int p[500100], l[500100], r[500100];   int m;   char ans[500100], s[500100];   int n;   bool ok(int i, int x) {     if (++i < x) return 0;     return ((r[i] - r[i - x] * p[x]) * p[i - x]) == (l[i] - l[i - x]);   }   bool dfs(int i, int x) {     if (i == n) {       puts(ans);       return 1;     }     ans[i] = x ? s[i] :  a ;     for (; ans[i] <=  z ; ans[i]++) {       l[i + 1] = l[i] + ans[i] * p[i];       r[i + 1] = r[i] * P + ans[i];       if (!ok(i, m) && !ok(i, m + 1) && dfs(i + 1, x && (ans[i] == s[i])))         return 1;     }     return 0;   }   int main() {     m = read();     scanf( %s , s);     n = strlen(s);     int i;     for (i = n - 1; i >= 0 && s[i] ==  z ; i--) s[i] =  a ;     if (i == -1) {       puts( Impossible );       return 0;     }     s[i]++;     p[0] = 1;     for (int i = 1; i < 500100; i++) p[i] = p[i - 1] * P;     if (!dfs(0, 1)) puts( Impossible );     return 0;   }   