#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <queue>
#include <climits>
#include <cmath>
#include <functional>
#include <type_traits>
#include <bitset>
#include <fstream>
#define int long long
using namespace std;
void solve() {
int n;
string s;
cin >> n >> s;
vector<int> zArr(s.size());
vector<int> res;
int l = 0, r = 0;
for (int i = 0; i < s.size(); i++)
{
if (i > r)
{
// Use naive
r = i;
l = 0;
while (r < s.size() && s[l] == s[r])
{
l++;
r++;
}
r--;
l = i;
zArr[i] = r-i+1;
}
else
{
if (zArr[i-l] < r-i+1)
{
zArr[i] = zArr[i-l];
}
else
{
l = r-i+1;
r = r+1;
while (r < s.size() && s[l] == s[r])
{
l++;
r++;
}
l = i;
r--;
zArr[i] = r-l+1;
}
}
if (zArr[i] + i == s.size())
res.push_back(zArr[i]);
}
int mult = 1;
for (int i = s.size(); i < n; i++)
{
mult = (mult * 26) % 1000000007;
}
int res2 = 0;
for (int i = 0; i < min(s.size()-res.size()+1, n-s.size()+1); i++)
{
res2 = (res2+ mult) % 1000000007;
}
cout << res2;
}
signed main() {
//cin.tie(0);
//ios_base::sync_with_stdio(false);
int t = 1;
//ifstream f("testcase.txt");
//cin.rdbuf(f.rdbuf());
//cin >> t;
while (t--) { solve(); }
}