#include <bits/stdc++.h>
using namespace std;

#define int long long
#define form2(i, a, b) for (int i = (a); i < (b); ++i)
#define ford2(i, a, b) for (int i = (a-1); i >= (b); --i)
#define form(i, n) form2(i, 0, n)
#define ford(i, n) ford2(i, n, 0)

#define chmax(x, v) x = max(x, (v))
#define chmin(x, v) x = min(x, (v))
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vsz(v) (int)(v.size())
#define pb push_back

const long long BIG = 1000000000000000000LL;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

void solve();
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

typedef unsigned long long ull;
typedef __uint128_t L;
struct FastMod {
	ull b, m;
	FastMod(ull b) : b(b), m(ull((L(1) << 64) / b)) {}
	ull reduce(ull a) {
		ull q = (ull)((L(m) * a) >> 64);
		ull r = a - q * b; // can be proven that 0 <= r < 2*b
		return r >= b ? r - b : r;
	}
};
const int m197 = (int)(1e9) + 7;
FastMod F(m197);

template<int MOD>
struct ModInt
{
	long long x;
	ModInt() : x(0) { }
	ModInt(long long u) : x(u) { if (x >= MOD || x < 0) { x = F.reduce(x); if (x < 0) x += MOD; } }
	ModInt(const ModInt &m) : x(m.x) { }
	ModInt& operator=(const ModInt &m) { x = m.x; return *this; }
	friend bool operator==(const ModInt& a, const ModInt& b) { return a.x == b.x; }
	friend bool operator!=(const ModInt& a, const ModInt& b) { return a.x != b.x; }
	friend bool operator<(const ModInt& a, const ModInt& b) { return a.x < b.x; }

	ModInt& operator+=(const ModInt& m) { x += m.x; if (x >= MOD) x -= MOD; return *this; }
	ModInt& operator-=(const ModInt& m) { x -= m.x; if (x < 0) x += MOD; return *this; }
	ModInt& operator*=(const ModInt& m) { x = F.reduce(x*m.x); return *this; }

	friend ModInt operator+(const ModInt& a, const ModInt &b) { return ModInt(a) += ModInt(b); }
	friend ModInt operator-(const ModInt& a, const ModInt &b) { return ModInt(a) -= ModInt(b); }
	friend ModInt operator*(const ModInt& a, const ModInt &b) { return ModInt(a) *= ModInt(b); }

	static long long fp(long long u, int k)
	{
		if (k == 0) return 1;
		long long res = fp(u, k/2);
		res = (res*res) % MOD;
		if (k & 1) res = (res*u) % MOD;
		return res;
	}

	ModInt fastpow(int k) { return ModInt(fp(x, k)); }
	ModInt inv() { return ModInt(fp(x, MOD-2)); }
};

using num = ModInt<m197>;

const int borne = (int)(1e5) + 5;
int nbReq;
num alpha[2];
num powAlpha[2][borne];
num powInv[2][borne];
num fact[borne];
num invfact[borne];
vector<num> rep[borne];

num binom(int n, int k)
{
	if (k < 0 || k > n) return num(0);
	return fact[n] * invfact[k] * invfact[n-k];
}

void calc(int szstr)
{
	rep[szstr].resize(borne);
	num somme = 0;
	for (int n = szstr; n < borne; ++n) {
		somme += binom(n-1, szstr-1) * powAlpha[0][n-szstr] * powInv[1][n];
		rep[szstr][n] = powAlpha[1][n] * somme;
	}
}

void solve()
{
	fact[0] = num(1);
	form2(i, 1, borne) fact[i] = fact[i-1] * num(i);
	form(i, borne) invfact[i] = fact[i].inv();

	alpha[0] = num(25);
	alpha[1] = num(26);
	form(k, 2) {
		powAlpha[k][0].x = 1;
		powInv[k][0].x = 1;
		powAlpha[k][1] = alpha[k];
		powInv[k][1] = alpha[k].inv();
		form2(i, 2, borne) {
			powAlpha[k][i] = powAlpha[k][i-1] * powAlpha[k][1];
			powInv[k][i] = powInv[k][i-1] * powInv[k][1];
		}
	}
	int nbReq; cin >> nbReq;
	string s; cin >> s;
	int cur = s.size();
	form(i, nbReq) {
		int mode; cin >> mode;
		if (mode == 1) {
			cin >> s;
			if (cur != vsz(s) && cur > 70) {
				rep[cur].clear();
				rep[cur].shrink_to_fit();
			}
			cur = s.size();
		} else {
			if (rep[cur].empty()) calc(cur);
			int x; cin >> x;
			cout << rep[cur][x].x << "\n";
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

#define int long long
#define form2(i, a, b) for (int i = (a); i < (b); ++i)
#define ford2(i, a, b) for (int i = (a-1); i >= (b); --i)
#define form(i, n) form2(i, 0, n)
#define ford(i, n) ford2(i, n, 0)

#define chmax(x, v) x = max(x, (v))
#define chmin(x, v) x = min(x, (v))
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vsz(v) (int)(v.size())
#define pb push_back

const long long BIG = 1000000000000000000LL;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

void solve();
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

template<int MOD>
struct ModInt
{
	long long x;
	ModInt() : x(0) { }
	ModInt(long long u) : x(u) { if (x >= MOD || x < 0) { x %= MOD; if (x < 0) x += MOD; } }
	ModInt(const ModInt &m) : x(m.x) { }
	ModInt& operator=(const ModInt &m) { x = m.x; return *this; }
	friend bool operator==(const ModInt& a, const ModInt& b) { return a.x == b.x; }
	friend bool operator!=(const ModInt& a, const ModInt& b) { return a.x != b.x; }
	friend bool operator<(const ModInt& a, const ModInt& b) { return a.x < b.x; }

	ModInt& operator+=(const ModInt& m) { x += m.x; if (x >= MOD) x -= MOD; return *this; }
	ModInt& operator-=(const ModInt& m) { x -= m.x; if (x < 0) x += MOD; return *this; }
	ModInt& operator*=(const ModInt& m) { x = (x*m.x)%MOD; return *this; }

	friend ModInt operator+(const ModInt& a, const ModInt &b) { return ModInt(a) += ModInt(b); }
	friend ModInt operator-(const ModInt& a, const ModInt &b) { return ModInt(a) -= ModInt(b); }
	friend ModInt operator*(const ModInt& a, const ModInt &b) { return ModInt(a) *= ModInt(b); }

	static long long fp(long long u, int k)
	{
		if (k == 0) return 1;
		long long res = fp(u, k/2);
		res = (res*res) % MOD;
		if (k & 1) res = (res*u) % MOD;
		return res;
	}

	ModInt fastpow(int k) { return ModInt(fp(x, k)); }
	ModInt inv() { return ModInt(fp(x, MOD-2)); }
};

const int m197 = (int)(1e9) + 7;
using num = ModInt<m197>;

const int borne = (int)(1e5) + 5;
int nbReq;
num alpha[2];
num powAlpha[2][borne];
num powInv[2][borne];
num fact[borne];
num invfact[borne];
vector<num> rep[borne];

num binom(int n, int k)
{
	if (k < 0 || k > n) return num(0);
	return fact[n] * invfact[k] * invfact[n-k];
}

void calc(int szstr)
{
	rep[szstr].resize(borne);
	num somme = 0;
	for (int n = szstr; n < borne; ++n) {
		somme += binom(n-1, szstr-1) * powAlpha[0][n-szstr] * powInv[1][n];
		rep[szstr][n] = powAlpha[1][n] * somme;
	}
}

void solve()
{
	fact[0] = num(1);
	form2(i, 1, borne) fact[i] = fact[i-1] * num(i);
	form(i, borne) invfact[i] = fact[i].inv();

	alpha[0] = num(25);
	alpha[1] = num(26);
	form(k, 2) {
		powAlpha[k][0].x = 1;
		powInv[k][0].x = 1;
		powAlpha[k][1] = alpha[k];
		powInv[k][1] = alpha[k].inv();
		form2(i, 2, borne) {
			powAlpha[k][i] = powAlpha[k][i-1] * powAlpha[k][1];
			powInv[k][i] = powInv[k][i-1] * powInv[k][1];
		}
	}
	int nbReq; cin >> nbReq;
	string s; cin >> s;
	int cur = s.size();
	form(i, nbReq) {
		int mode; cin >> mode;
		if (mode == 1) {
			cin >> s;
			if (cur != vsz(s) && cur > 100) {
				rep[cur].clear();
				rep[cur].shrink_to_fit();
			}
			cur = s.size();
		} else {
			if (rep[cur].empty()) calc(cur);
			int x; cin >> x;
			cout << rep[cur][x].x << "\n";
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

#define int long long
#define form2(i, a, b) for (int i = (a); i < (b); ++i)
#define ford2(i, a, b) for (int i = (a-1); i >= (b); --i)
#define form(i, n) form2(i, 0, n)
#define ford(i, n) ford2(i, n, 0)

#define chmax(x, v) x = max(x, (v))
#define chmin(x, v) x = min(x, (v))
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vsz(v) (int)(v.size())
#define pb push_back

const long long BIG = 1000000000000000000LL;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

void solve();
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

template<const int MOD>
struct ModInt
{
	long long x;
	ModInt() : x(0) { }
	ModInt(long long u) : x(u) { if (x >= MOD || x < 0) { x %= MOD; if (x < 0) x += MOD; } }
	ModInt(const ModInt &m) : x(m.x) { }
	ModInt& operator=(const ModInt &m) { x = m.x; return *this; }
	friend bool operator==(const ModInt& a, const ModInt& b) { return a.x == b.x; }
	friend bool operator!=(const ModInt& a, const ModInt& b) { return a.x != b.x; }
	friend bool operator<(const ModInt& a, const ModInt& b) { return a.x < b.x; }

	ModInt& operator+=(const ModInt& m) { x += m.x; if (x >= MOD) x -= MOD; return *this; }
	ModInt& operator-=(const ModInt& m) { x -= m.x; if (x < 0) x += MOD; return *this; }
	ModInt& operator*=(const ModInt& m) { x = (x*m.x)%MOD; return *this; }

	friend ModInt operator+(const ModInt& a, const ModInt &b) { return ModInt(a) += ModInt(b); }
	friend ModInt operator-(const ModInt& a, const ModInt &b) { return ModInt(a) -= ModInt(b); }
	friend ModInt operator*(const ModInt& a, const ModInt &b) { return ModInt(a) *= ModInt(b); }

	static long long fp(long long u, int k)
	{
		if (k == 0) return 1;
		long long res = fp(u, k/2);
		res = (res*res) % MOD;
		if (k & 1) res = (res*u) % MOD;
		return res;
	}

	ModInt fastpow(int k) { return ModInt(fp(x, k)); }
	ModInt inv() { return ModInt(fp(x, MOD-2)); }
};

const int m197 = (int)(1e9) + 7;
using num = ModInt<m197>;

const int borne = (int)(1e5) + 5;
int nbReq;
num alpha[2];
num powAlpha[2][borne];
num powInv[2][borne];
num fact[borne];
num invfact[borne];
vector<num> rep[borne];

num binom(int n, int k)
{
	if (k < 0 || k > n) return num(0);
	return fact[n] * invfact[k] * invfact[n-k];
}

void calc(int szstr)
{
	rep[szstr].resize(borne);
	num somme = 0;
	for (int n = szstr; n < borne; ++n) {
		somme += binom(n-1, szstr-1) * powAlpha[0][n-szstr] * powInv[1][n];
		rep[szstr][n] = powAlpha[1][n] * somme;
	}
}

void solve()
{
	fact[0] = num(1);
	form2(i, 1, borne) fact[i] = fact[i-1] * num(i);
	form(i, borne) invfact[i] = fact[i].inv();

	alpha[0] = num(25);
	alpha[1] = num(26);
	form(k, 2) {
		powAlpha[k][0].x = 1;
		powInv[k][0].x = 1;
		powAlpha[k][1] = alpha[k];
		powInv[k][1] = alpha[k].inv();
		form2(i, 2, borne) {
			powAlpha[k][i] = powAlpha[k][i-1] * powAlpha[k][1];
			powInv[k][i] = powInv[k][i-1] * powInv[k][1];
		}
	}
	int nbReq; cin >> nbReq;
	string s; cin >> s;
	int cur = s.size();
	form(i, nbReq) {
		int mode; cin >> mode;
		if (mode == 1) {
			cin >> s;
			if (cur != vsz(s) && cur > 50) {
				rep[cur].clear();
				rep[cur].shrink_to_fit();
			}
			cur = s.size();
		} else {
			if (rep[cur].empty()) calc(cur);
			int x; cin >> x;
			cout << rep[cur][x].x << "\n";
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

#define int long long
#define form2(i, a, b) for (int i = (a); i < (b); ++i)
#define ford2(i, a, b) for (int i = (a-1); i >= (b); --i)
#define form(i, n) form2(i, 0, n)
#define ford(i, n) ford2(i, n, 0)

#define chmax(x, v) x = max(x, (v))
#define chmin(x, v) x = min(x, (v))
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vsz(v) (int)(v.size())
#define pb push_back

const long long BIG = 1000000000000000000LL;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

void solve();
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

template<int MOD>
struct ModInt
{
	long long x;
	ModInt() : x(0) { }
	ModInt(long long u) : x(u) { if (x >= MOD || x < 0) { x %= MOD; if (x < 0) x += MOD; } }
	ModInt(const ModInt &m) : x(m.x) { }
	ModInt& operator=(const ModInt &m) { x = m.x; return *this; }
	friend bool operator==(const ModInt& a, const ModInt& b) { return a.x == b.x; }
	friend bool operator!=(const ModInt& a, const ModInt& b) { return a.x != b.x; }
	friend bool operator<(const ModInt& a, const ModInt& b) { return a.x < b.x; }

	ModInt& operator+=(const ModInt& m) { x += m.x; if (x >= MOD) x -= MOD; return *this; }
	ModInt& operator-=(const ModInt& m) { x -= m.x; if (x < 0) x += MOD; return *this; }
	ModInt& operator*=(const ModInt& m) { x = (x*m.x)%MOD; return *this; }

	friend ModInt operator+(const ModInt& a, const ModInt &b) { return ModInt(a) += ModInt(b); }
	friend ModInt operator-(const ModInt& a, const ModInt &b) { return ModInt(a) -= ModInt(b); }
	friend ModInt operator*(const ModInt& a, const ModInt &b) { return ModInt(a) *= ModInt(b); }

	static long long fp(long long u, int k)
	{
		if (k == 0) return 1;
		long long res = fp(u, k/2);
		res = (res*res) % MOD;
		if (k & 1) res = (res*u) % MOD;
		return res;
	}

	ModInt fastpow(int k) { return ModInt(fp(x, k)); }
	ModInt inv() { return ModInt(fp(x, MOD-2)); }
};

const int m197 = (int)(1e9) + 7;
using num = ModInt<m197>;

const int borne = (int)(1e5) + 5;
int nbReq;
num alpha[2];
num powAlpha[2][borne];
num powInv[2][borne];
num fact[borne];
num invfact[borne];
vector<num> rep[borne];

num binom(int n, int k)
{
	if (k < 0 || k > n) return num(0);
	return fact[n] * invfact[k] * invfact[n-k];
}

void calc(int szstr)
{
	rep[szstr].resize(borne);
	num somme = 0;
	for (int n = szstr; n < borne; ++n) {
		somme += binom(n-1, szstr-1) * powAlpha[0][n-szstr] * powInv[1][n];
		rep[szstr][n] = powAlpha[1][n] * somme;
	}
}

void solve()
{
	fact[0] = num(1);
	form2(i, 1, borne) fact[i] = fact[i-1] * num(i);
	form(i, borne) invfact[i] = fact[i].inv();

	alpha[0] = num(25);
	alpha[1] = num(26);
	form(k, 2) {
		powAlpha[k][0].x = 1;
		powInv[k][0].x = 1;
		powAlpha[k][1] = alpha[k];
		powInv[k][1] = alpha[k].inv();
		form2(i, 2, borne) {
			powAlpha[k][i] = powAlpha[k][i-1] * powAlpha[k][1];
			powInv[k][i] = powInv[k][i-1] * powInv[k][1];
		}
	}
	int nbReq; cin >> nbReq;
	string s; cin >> s;
	int cur = s.size();
	form(i, nbReq) {
		int mode; cin >> mode;
		if (mode == 1) {
			cin >> s; cur = s.size();
		} else {
			if (rep[cur].empty()) calc(cur);
			int x; cin >> x;
			cout << rep[cur][x].x << "\n";
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define D(x)    cout << #x " = " <<(x) << endl
#define MAX     100000
#define MOD     1000000007
typedef long long int LL;

const int SQRTN = 320;
char str[MAX+5];
int dp[MAX+5], fact[MAX+5], inv[MAX+5], p25[MAX+5], p26[MAX+5], p26_inv[MAX+5];

int add(int u, int v){
    int ret = (u + v);
    if(ret >= MOD) ret -= MOD;
    return ret;
}

int sub(int u, int v){
    int ret = u - v;
    if(ret < 0) ret += MOD;
    return ret;
}

LL mul(LL u, LL v){
    LL ret = (u * v) % MOD;
    return ret;
}

int nCr(int n, int r){
    if(r > n) return 0;
    if(n == r || r == 0) return 1;

    int ret = fact[n];
    ret = mul(ret, inv[n - r]);
    ret = mul(ret, inv[r]);
    return ret;
}

int ip(int a, int p){
    if(!p) return 1;
    if(p & 1) return mul(a, ip(a, p - 1));
    int ret = ip(a, p/2);
    return mul(ret, ret);
}

void init(){
    int i;

    fact[0] = inv[0] = 1;
    for(i = 1; i <= MAX; i++){
        fact[i] = mul(i, fact[i - 1]);
        inv[i] = ip(fact[i], MOD - 2);
    }

    p25[0] = p26[0] = p26_inv[0] = 1;
    for(i = 1; i <= MAX; i++){
        p25[i] = mul(25, p25[i - 1]);
        p26[i] = mul(26, p26[i - 1]);
        p26_inv[i] = ip(p26[i], MOD - 2);
    }

}

int main()
{
//    freopen("in.txt", "r", stdin);
    int t, tp, n, k, p;
    init();

    scanf("%d", &t);
    scanf("%s", str + 1);

    k = strlen(str + 1);
    if(k > SQRTN){
        for(p = 1; p < k; p++) dp[p] = 0;
        for(p = k; p <= MAX; p++){
            dp[p] = add(dp[p - 1] , mul( mul(nCr(p - 1, k - 1) , p25[p - k]) , p26_inv[p]));
        }
    }

    while(t--){
        scanf("%d", &tp);
        if(tp == 1){
            scanf("%s", str + 1);
            k = strlen(str + 1);
            if(k > SQRTN){

                for(p = 1; p < k; p++) dp[p] = 0;
                for(p = k; p <= MAX; p++){
                    dp[p] = add(dp[p - 1] , mul( mul(nCr(p - 1, k - 1) , p25[p - k]) , p26_inv[p]));
                }
            }
        }
        else{
            scanf("%d", &n);
            int answer = 0;
            if(k <= SQRTN){
                answer = p26[n];

                for(int u = 0; u < k; u++){
                    int current = mul( nCr(n, u), p25[n - u] );
                    answer = sub(answer, current);
                }
            }
            else answer = mul( dp[n], p26[n]);
            printf("%d\n", answer);
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

 ll q=26;

ll fac[100005];
ll inv[100005];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1;

    ll x=fac[n];
    ll y=inv[r];
    ll z=inv[n-r];

    x=(x*y)%mod;

    x=(x*z)%mod;

    return x;
}
void solve()
{
    fac[0]=1;

    for(ll i=1;i<100005;i++)
    fac[i]=(i*fac[i-1])%mod;

    for(ll i=0;i<100005;i++)
    inv[i]=inv_mod(fac[i]);

  ll m;
  scanf("%lld",&m);

  char s[100005];
  scanf("%s",s);

  vector<pii>query;

  ll v[100005]={0};
  vector<ll>ans[100005];

  ll len=strlen(s);

  while(m--){
      ll t;
      scanf("%lld",&t);

      if(t==1){
         scanf("%s",s);
         len=strlen(s);
      }
      else{
          ll x;
          scanf("%lld",&x);
          query.pb({len,x});
          v[len]=max(v[len],x);
      }
  }

  for(ll mods=1;mods<100005;mods++){
      if(v[mods]<mods)
      continue;

      //srt(v[mods]);

    //  ll x=v[mods];

     // cout<<x<<endl;

      ll res=0;

      ll prev=0;

      ll x,y;
      x=1;
      y=1;

      for(ll k=mods;k<=v[mods];k++){
          ll temp;
         temp=ncr(k-1,mods-1);

          temp*=x;
          temp%=mod;

          prev*=q;
          prev%=mod;

          prev+=temp;
          prev%=mod;

          x*=(q-1);
          x%=mod;

        //  ll to=(res*pow_mod(q,k))%mod;

          ans[mods].pb(prev);
      }
  }

  for(auto qq:query){
      ll mods=qq.ff;
      ll n=qq.ss;

      if(mods>n)
      {
          printf("0\n");
          continue;
      }

      ll res=ans[mods][n-mods];

      printf("%lld\n",res);

      //cout<<mods<<" "<<n<<endl;
  }

}
int32_t main()
{

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

 ll q=26;

ll fac[100005];
ll inv[100005];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1;

    ll x=fac[n];
    ll y=inv[r];
    ll z=inv[n-r];

    x=(x*y)%mod;

    x=(x*z)%mod;

    return x;
}
void solve()
{
    fac[0]=1;

    for(ll i=1;i<100005;i++)
    fac[i]=(i*fac[i-1])%mod;

    for(ll i=0;i<100005;i++)
    inv[i]=inv_mod(fac[i]);

  ll m;
  scanf("%lld",&m);

  char s[100005];
  scanf("%s",s);

  vector<pii>query;

  ll v[100005]={0};
  vector<ll>ans[100005];

  ll len=strlen(s);

  while(m--){
      ll t;
      scanf("%lld",&t);

      if(t==1){
         scanf("%s",s);
         len=strlen(s);
      }
      else{
          ll x;
          scanf("%lld",&x);
          query.pb({len,x});
          v[len]=max(v[len],x);
      }
  }

  for(ll mods=1;mods<100005;mods++){
      if(v[mods]<mods)
      continue;

      //srt(v[mods]);

      ll x=v[mods];

     // cout<<x<<endl;

      ll res=0;

      for(ll k=mods;k<=x;k++){
          ll temp;
         temp=ncr(k-1,mods-1);
          temp=(temp*pow_mod(q-1,k-mods))%mod;

          temp=(temp*inv_mod(pow_mod(q,k)))%mod;

          res+=temp;
          res%=mod;

          ll to=(res*pow_mod(q,k))%mod;

          ans[mods].pb(to);
      }
  }

  for(auto qq:query){
      ll mods=qq.ff;
      ll n=qq.ss;

      if(mods>n)
      {
          printf("0\n");
          continue;
      }

      ll res=ans[mods][n-mods];

      printf("%lld\n",res);

      //cout<<mods<<" "<<n<<endl;
  }

}
int32_t main()
{

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

 ll q=26;

ll fac[100005];
ll inv[100005];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1;

    ll x=fac[n];
    ll y=inv[r];
    ll z=inv[n-r];

    x=(x*y)%mod;

    x=(x*z)%mod;

    return x;
}
void solve()
{
    fac[0]=1;

    for(ll i=1;i<100005;i++)
    fac[i]=(i*fac[i-1])%mod;

    for(ll i=0;i<100005;i++)
    inv[i]=inv_mod(fac[i]);

  ll m;
  cin>>m;

  string s;
  cin>>s;
  vector<pii>query;

  vector<ll>v[100005];
  vector<ll>ans[100005];

  while(m--){
      ll t;
      cin>>t;

      if(t==1){
          cin>>s;
      }
      else{
          ll x;
          cin>>x;
          query.pb({s.size(),x});
          v[s.size()].pb(x);
      }
  }

  for(ll mods=1;mods<100005;mods++){
      if(v[mods].empty())
      continue;

      srt(v[mods]);

      ll x=v[mods].back();

     // cout<<x<<endl;

      ll res=0;

      for(ll k=mods;k<=x;k++){
          ll temp;
         temp=ncr(k-1,mods-1);
          temp=(temp*pow_mod(q-1,k-mods))%mod;

          temp=(temp*inv_mod(pow_mod(q,k)))%mod;

          res+=temp;
          res%=mod;

          ll to=(res*pow_mod(q,k))%mod;

          ans[mods].pb(to);
      }
  }

  for(auto qq:query){
      ll mods=qq.ff;
      ll n=qq.ss;

      ll res=ans[mods][n-mods];

      cout<<res<<endl;

      //cout<<mods<<" "<<n<<endl;
  }

}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

 ll q=26;

ll fac[100005];
ll inv[100005];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1;

    ll x=fac[n];
    ll y=inv[r];
    ll z=inv[n-r];

    x=(x*y)%mod;

    x=(x*z)%mod;

    return x;
}
void solve()
{
    fac[0]=1;

    for(ll i=1;i<100005;i++)
    fac[i]=(i*fac[i-1])%mod;

    for(ll i=0;i<100005;i++)
    inv[i]=inv_mod(fac[i]);

  ll m;
  cin>>m;

  string s;
  cin>>s;

  vector<pii>query;

  ll v[100005]={0};
  vector<ll>ans[100005];

  ll len=s.size();

  while(m--){
      ll t;
      //scanf("%lld",&t);
      cin>>t;

      if(t==1){
         cin>>s;
         len=s.size();
      }
      else{
          ll x;
          //scanf("%lld",&x);
          cin>>x;
          query.pb({len,x});
          v[len]=max(v[len],x);
      }
  }

  for(ll mods=1;mods<100005;mods++){
      if(v[mods]<mods)
      continue;

      //srt(v[mods]);

    //  ll x=v[mods];

     // cout<<x<<endl;

      ll res=0;

      ll prev=0;

      ll x,y;
      x=1;
      y=1;

      for(ll k=mods;k<=v[mods];k++){
          ll temp;
         temp=ncr(k-1,mods-1);

          temp*=x;
          temp%=mod;

          prev*=q;
          prev%=mod;

          prev+=temp;
          prev%=mod;

          x*=(q-1);
          x%=mod;

        //  ll to=(res*pow_mod(q,k))%mod;

          ans[mods].pb(prev);
      }
  }

  for(auto qq:query){
      ll mods=qq.ff;
      ll n=qq.ss;

      if(mods>n)
      {
          cout<<"0\n";
          continue;
      }

      ll res=ans[mods][n-mods];

     cout<<res<<endl;

      //cout<<mods<<" "<<n<<endl;
  }

}
int32_t main()
{

//Start from Here.
   ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

 ll q=26;

ll fac[100005];
ll inv[100005];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1;

    ll x=fac[n];
    ll y=inv[r];
    ll z=inv[n-r];

    x=(x*y)%mod;

    x=(x*z)%mod;

    return x;
}
void solve()
{
    fac[0]=1;

    for(ll i=1;i<100005;i++)
    fac[i]=(i*fac[i-1])%mod;

    for(ll i=0;i<100005;i++)
    inv[i]=inv_mod(fac[i]);

  ll m;
  scanf("%lld",&m);

  char s[100005];
  scanf("%s",s);

  vector<pii>query;

  vector<ll>v[100005];
  vector<ll>ans[100005];

  ll len=strlen(s);

  while(m--){
      ll t;
      scanf("%lld",&t);

      if(t==1){
         scanf("%s",s);
         len=strlen(s);
      }
      else{
          ll x;
          scanf("%lld",&x);
          query.pb({len,x});
          v[len].pb(x);
      }
  }

  for(ll mods=1;mods<100005;mods++){
      if(v[mods].empty())
      continue;

      srt(v[mods]);

      ll x=v[mods].back();

     // cout<<x<<endl;

      ll res=0;

      for(ll k=mods;k<=x;k++){
          ll temp;
         temp=ncr(k-1,mods-1);
          temp=(temp*pow_mod(q-1,k-mods))%mod;

          temp=(temp*inv_mod(pow_mod(q,k)))%mod;

          res+=temp;
          res%=mod;

          ll to=(res*pow_mod(q,k))%mod;

          ans[mods].pb(to);
      }
  }

  for(auto qq:query){
      ll mods=qq.ff;
      ll n=qq.ss;

      if(mods>n)
      {
          printf("0\n");
          continue;
      }

      ll res=ans[mods][n-mods];

      printf("%lld\n",res);

      //cout<<mods<<" "<<n<<endl;
  }

}
int32_t main()
{

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

 ll q=26;

ll fac[100005];
ll inv[100005];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1;

    ll x=fac[n];
    ll y=inv[r];
    ll z=inv[n-r];

    x=(x*y)%mod;

    x=(x*z)%mod;

    return x;
}
void solve()
{
    fac[0]=1;

    for(ll i=1;i<100005;i++)
    fac[i]=(i*fac[i-1])%mod;

    for(ll i=0;i<100005;i++)
    inv[i]=inv_mod(fac[i]);

  ll m;
  cin>>m;

  string s;
  cin>>s;
  vector<pii>query;

  vector<ll>v[100005];
  vector<ll>ans[100005];

  while(m--){
      ll t;
      cin>>t;

      if(t==1){
          cin>>s;
      }
      else{
          ll x;
          cin>>x;
          query.pb({s.size(),x});
          v[s.size()].pb(x);
      }
  }

  for(ll mods=1;mods<100005;mods++){
      if(v[mods].empty())
      continue;

      srt(v[mods]);

      ll x=v[mods].back();

     // cout<<x<<endl;

      ll res=0;

      for(ll k=mods;k<=x;k++){
          ll temp;
         temp=ncr(k-1,mods-1);
          temp=(temp*pow_mod(q-1,k-mods))%mod;

          temp=(temp*inv_mod(pow_mod(q,k)))%mod;

          res+=temp;
          res%=mod;

          ll to=(res*pow_mod(q,k))%mod;

          ans[mods].pb(to);
      }
  }

  for(auto qq:query){
      ll mods=qq.ff;
      ll n=qq.ss;

      if(mods>n)
      {
          cout<<"0\n";
          continue;
      }

      ll res=ans[mods][n-mods];

      cout<<res<<endl;

      //cout<<mods<<" "<<n<<endl;
  }

}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

 ll q=26;

ll fac[100005];
ll inv[100005];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1;

    ll x=fac[n];
    ll y=inv[r];
    ll z=inv[n-r];

    x=(x*y)%mod;

    x=(x*z)%mod;

    return x;
}
void solve()
{
    fac[0]=1;

    for(ll i=1;i<100005;i++)
    fac[i]=(i*fac[i-1])%mod;

    for(ll i=0;i<100005;i++)
    inv[i]=inv_mod(fac[i]);

  ll m;
  scanf("%lld",&m);

  char s[100005];
  scanf("%s",s);

  vector<pii>query;

  vector<ll>v[100005];
  vector<ll>ans[100005];

  while(m--){
      ll t;
      scanf("%lld",&t);

      if(t==1){
         scanf("%s",s);

      }
      else{
          ll x;
          scanf("%lld",&x);
          query.pb({strlen(s),x});
          v[strlen(s)].pb(x);
      }
  }

  for(ll mods=1;mods<100005;mods++){
      if(v[mods].empty())
      continue;

      srt(v[mods]);

      ll x=v[mods].back();

     // cout<<x<<endl;

      ll res=0;

      for(ll k=mods;k<=x;k++){
          ll temp;
         temp=ncr(k-1,mods-1);
          temp=(temp*pow_mod(q-1,k-mods))%mod;

          temp=(temp*inv_mod(pow_mod(q,k)))%mod;

          res+=temp;
          res%=mod;

          ll to=(res*pow_mod(q,k))%mod;

          ans[mods].pb(to);
      }
  }

  for(auto qq:query){
      ll mods=qq.ff;
      ll n=qq.ss;

      if(mods>n)
      {
          printf("0\n");
          continue;
      }

      ll res=ans[mods][n-mods];

      printf("%lld\n",res);

      //cout<<mods<<" "<<n<<endl;
  }

}
int32_t main()
{

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

 ll q=26;

ll fac[100005];
ll inv[100005];

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1;

    ll x=fac[n];
    ll y=inv[r];
    ll z=inv[n-r];

    x=(x*y)%mod;

    x=(x*z)%mod;

    return x;
}
void solve()
{
    fac[0]=1;

    for(ll i=1;i<100005;i++)
    fac[i]=(i*fac[i-1])%mod;

    for(ll i=0;i<100005;i++)
    inv[i]=inv_mod(fac[i]);

  ll m;
  cin>>m;

  string s;
  cin>>s;

  vector<pii>query[100005];

  ll v[100005]={0};
  ll ans[m];

  ll pp[100005]={0};

  ll len=s.size();
  ll id=0;

  ll ssize[m];
  ll xsize[m];

  while(m--){
      ll t;
      //scanf("%lld",&t);
      cin>>t;

      if(t==1){
         cin>>s;
         len=s.size();
      }
      else{
          ll x;
          //scanf("%lld",&x);
          cin>>x;
          ssize[id]=len;
          xsize[id]=x;
          query[len].pb({id++,x});
          v[len]=max(v[len],x);
      }
  }

  for(ll mods=1;mods<100005;mods++){
      if(v[mods]<mods)
      continue;

      //srt(v[mods]);

    //  ll x=v[mods];

     // cout<<x<<endl;

      ll res=0;

      ll prev=0;

      ll x,y;
      x=1;
      y=1;

      for(ll k=mods;k<=v[mods];k++){
          ll temp;
         temp=ncr(k-1,mods-1);

          temp*=x;
          temp%=mod;

          prev*=q;
          prev%=mod;

          prev+=temp;
          prev%=mod;

          x*=(q-1);
          x%=mod;

        //  ll to=(res*pow_mod(q,k))%mod;
          pp[k]=prev;
      }

      for(auto aa:query[mods]){
          if(aa.ss<mods)
          ans[aa.ff]=0;
          else
          ans[aa.ff]=pp[aa.ss];
      }
  }

  for(ll i=0;i<id;i++){
      ll mods=ssize[i];
      ll n=xsize[i];

      if(mods>n)
      {
          cout<<"0\n";
          continue;
      }

      ll res=ans[i];

     cout<<res<<endl;

      //cout<<mods<<" "<<n<<endl;
  }

}
int32_t main()
{

//Start from Here.
   ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include <bits/stdc++.h>
#define watch(x) std::cout << "$ LINE @" << __LINE__ << " FUNC @" << __FUNCTION__ << "\n$ " \
                           << (#x) << ": " << x << std::endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

template <typename Tp>
inline void read(Tp &x)
{
    static char c;
    static bool neg;
    x = 0, c = getchar(), neg = false;
    for (; !isdigit(c); c = getchar())
    {
        if (c == '-')
        {
            neg = true;
        }
    }
    for (; isdigit(c); c = getchar())
    {
        x = x * 10 + c - '0';
    }
    if (neg)
    {
        x = -x;
    }
}

const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

inline int power(int base, int exp)
{
    int res = 1;
    while (exp > 0)
    {
        if (exp & 1)
        {
            res = (ll)res * base % MOD;
        }
        base = (ll)base * base % MOD;
        exp >>= 1;
    }
    return res;
}
inline int inv(int x)
{
    return power(x, MOD - 2);
}

namespace Solve
{
    int fac[N] = {1}, facInv[N] = {1};
    int pow25[N] = {1};
    int pow26[N] = {1}, pow26Inv[N] = {1};
    inline int C(int n, int m)
    {
        return n < m ? 0
                     : (ll)fac[n] * facInv[m] % MOD * facInv[n - m] % MOD;
    }
    inline int sum(const int &x, const int &y)
    {
        int res = x + y;
        if (res >= MOD)
        {
            res -= MOD;
        }
        else if (res < 0)
        {
            res += MOD;
        }
        return res;
    }
    inline void init()
    {
        for (int i = 1; i < N; ++i)
        {
            fac[i] = (ll)fac[i - 1] * i % MOD;
            pow25[i] = (ll)pow25[i - 1] * 25 % MOD;
            pow26[i] = (ll)pow26[i - 1] * 26 % MOD;
        }
        facInv[N - 1] = inv(fac[N - 1]);
        pow26Inv[N - 1] = inv(pow26[N - 1]);
        for (int i = N - 2; i >= 1; --i)
        {
            facInv[i] = (ll)facInv[i + 1] * (i + 1) % MOD;
            pow26Inv[i] = (ll)pow26Inv[i + 1] * 26 % MOD;
        }
    }
    struct Query
    {
        int len, n, id;
        inline bool operator<(const Query &rhs) const
        {
            return len == rhs.len ? n < rhs.n
                                  : len < rhs.len;
        }
    } query[N];
    int Q = 0;
    inline void push(int len, int n)
    {
        query[++Q] = (Query){len, n, Q};
    }
    int f[N], ans[N];
    inline void calc(int len, int n)
    {
        f[len - 1] = 0;
        for (int i = len; i <= n; ++i)
        {
            f[i] = sum(f[i - 1], (ll)C(i - 1, len - 1) * pow25[i - len] % MOD * pow26[n] % MOD * pow26Inv[i] % MOD);
        }
    }
    inline void main()
    {
        sort(query + 1, query + Q + 1);
        for (int l = 1, r, len; r = l, len = query[r].len, l <= Q; l = r + 1)
        {
            while (query[r + 1].len == len && r + 1 <= Q)
            {
                ++r;
            }
            calc(len, query[r].n);
            for (int i = l; i <= r; ++i)
            {
                ans[query[i].id] = f[query[i].n];
            }
        }
        for (int i = 1; i <= Q; ++i)
        {
            printf("%d\n", ans[i]);
        }
    }
} // namespace Solve

char str[N];

int m;

int main()
{
    Solve::init();
    read(m);
    scanf("%s", str);
    int len = strlen(str);
    for (int cas = 0, op, n; cas < m; ++cas)
    {
        read(op);
        if (op == 1)
        {
            scanf("%s", str);
            len = strlen(str);
        }
        else
        {
            read(n);
            Solve::push(len, n);
        }
    }
    Solve::main();
    return 0;
}


#include <bits/stdc++.h>
#define watch(x) std::cout << "$ LINE @" << __LINE__ << " FUNC @" << __FUNCTION__ << "\n$ " \
                           << (#x) << ": " << x << std::endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

template <typename Tp>
inline void read(Tp &x)
{
    static char c;
    static bool neg;
    x = 0, c = getchar(), neg = false;
    for (; !isdigit(c); c = getchar())
    {
        if (c == '-')
        {
            neg = true;
        }
    }
    for (; isdigit(c); c = getchar())
    {
        x = x * 10 + c - '0';
    }
    if (neg)
    {
        x = -x;
    }
}

const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

inline int power(int base, int exp)
{
    int res = 1;
    while (exp > 0)
    {
        if (exp & 1)
        {
            res = (ll)res * base % MOD;
        }
        base = (ll)base * base % MOD;
        exp >>= 1;
    }
    return res;
}
inline int inv(int x)
{
    return power(x, MOD - 2);
}

namespace Solve
{
    int fac[N] = {1}, facInv[N] = {1};
    int pow25[N] = {1};
    inline int C(int n, int m)
    {
        return n < m ? 0
                     : (ll)fac[n] * facInv[m] % MOD * facInv[n - m] % MOD;
    }
    inline int sum(const int &x, const int &y)
    {
        int res = x + y;
        if (res >= MOD)
        {
            res -= MOD;
        }
        else if (res < 0)
        {
            res += MOD;
        }
        return res;
    }
    inline void init()
    {
        for (int i = 1; i < N; ++i)
        {
            fac[i] = (ll)fac[i - 1] * i % MOD;
            pow25[i] = (ll)pow25[i - 1] * 25 % MOD;
        }
        facInv[N - 1] = inv(fac[N - 1]);
        for (int i = N - 2; i >= 1; --i)
        {
            facInv[i] = (ll)facInv[i + 1] * (i + 1) % MOD;
        }
    }
    struct Query
    {
        int len, n, id;
        inline bool operator<(const Query &rhs) const
        {
            return len == rhs.len ? n < rhs.n
                                  : len < rhs.len;
        }
    } query[N];
    int Q = 0;
    inline void push(int len, int n)
    {
        ++Q;
        query[Q] = (Query){len, n, Q};
    }
    int f[N], ans[N];
    inline void calc(int len, int n)
    {
        f[len] = 1;
        for (int i = len + 1; i <= n; ++i)
        {
            f[i] = sum((ll)f[i - 1] * 26 % MOD, (ll)C(i - 1, len - 1) * pow25[i - len] % MOD);
        }
    }
    inline void main()
    {
        sort(query + 1, query + Q + 1);
        for (int l = 1, r, len; r = l, len = query[r].len, l <= Q; l = r + 1)
        {
            while (query[r + 1].len == len && r + 1 <= Q)
            {
                ++r;
            }
            calc(len, query[r].n);
            for (int i = l; i <= r; ++i)
            {
                ans[query[i].id] = query[i].n < len ? 0 : f[query[i].n];
            }
        }
        for (int i = 1; i <= Q; ++i)
        {
            printf("%d\n", ans[i]);
        }
    }
} // namespace Solve

char str[N];

int m;

int main()
{
    Solve::init();
    read(m);
    scanf("%s", str);
    int len = strlen(str);
    for (int cas = 0, op, n; cas < m; ++cas)
    {
        read(op);
        if (op == 1)
        {
            scanf("%s", str);
            len = strlen(str);
        }
        else
        {
            read(n);
            Solve::push(len, n);
        }
    }
    Solve::main();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int qtop;
struct event{
	int cur,bas,id;
	bool operator<(const event &ob)const{
		if(cur!=ob.cur) return cur<ob.cur;
		return bas<ob.bas;
	}
}q[100010];
long long ans[100010],f[100010],pre[100010];
const long long mod=1e9+7;
long long fac[100010],facinv[100010],inv[100010];
long long com(int n,int k){
	return fac[n]*facinv[k]%mod*facinv[n-k]%mod;
}
long long qpow(long long base,int index){
	if(index<=0) return 1;
	if(index==1) return base;
	long long t=qpow(base,index>>1);
	if(index&1) return t*t%mod*base%mod;
	else return t*t%mod;
}
int main(){
	int m;
	scanf("%d",&m);
	scanf("%s",s);
	int len=strlen(s);
	int i,op,temp;
	fac[0]=facinv[0]=inv[0]=1;
	fac[1]=facinv[1]=inv[1]=1;
	for(i=2;i<=100000;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		facinv[i]=facinv[i-1]*inv[i]%mod;
	}
	for(i=0;i<m;i++){
		scanf("%d",&op);
		if(op==1){
			scanf("%s",s);
			len=strlen(s);
		}
		else{
			scanf("%d",&temp);
			qtop++;
			q[qtop]=(event){len,temp,qtop};
		}
	}
	sort(q+1,q+qtop+1);
	int last=0;
	for(i=1;i<=qtop;i++){
		if(q[i].cur!=last){
			last=q[i].cur;
			pre[last-1]=0;
			len=last-1;
		}
		if(len<q[i].bas){
			pre[len]=pre[len]*qpow(26,q[i].bas-len)%mod;
		}
		while(len<q[i].bas){
			len++;
			f[len]=com(len-1,last-1)*qpow(25,len-last)%mod*qpow(26,q[i].bas-len)%mod;
			pre[len]=(pre[len-1]+f[len])%mod;
		}
		ans[q[i].id]=pre[len];
	}
	for(i=1;i<=qtop;i++){
		printf("%lld\n",ans[i]);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int qtop;
struct event{
	int cur,bas,id;
	bool operator<(const event &ob)const{
		if(cur!=ob.cur) return cur<ob.cur;
		return bas<ob.bas;
	}
}q[100010];
long long ans[100010],f[100010],pre[100010];
const long long mod=1e9+7;
long long fac[100010],facinv[100010],inv[100010];
long long com(int n,int k){
	return fac[n]*facinv[k]%mod*facinv[n-k]%mod;
}
long long qpow(long long base,int index){
	if(index<=0) return 1;
	if(index==1) return base;
	long long t=qpow(base,index>>1);
	if(index&1) return t*t%mod*base%mod;
	else return t*t%mod;
}
int main(){
	int m;
	scanf("%d",&m);
	scanf("%s",s);
	int len=strlen(s);
	int i,op,temp;
	fac[0]=facinv[0]=inv[0]=1;
	fac[1]=facinv[1]=inv[1]=1;
	for(i=2;i<=100010;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		facinv[i]=facinv[i-1]*inv[i]%mod;
	}
	for(i=0;i<m;i++){
		scanf("%d",&op);
		if(op==1){
			scanf("%s",s);
			len=strlen(s);
		}
		else{
			scanf("%d",&temp);
			qtop++;
			q[qtop]=(event){len,temp,qtop};
		}
	}
	sort(q+1,q+qtop+1);
	int last=0;
	for(i=1;i<=qtop;i++){
		if(q[i].cur!=last){
			last=q[i].cur;
			len=0;
		}
		if(len<q[i].bas){
			pre[len]=pre[len]*qpow(26,q[i].bas-len)%mod;
		}
		while(len<q[i].bas){
			len++;
			if(len<last) f[len]=0;
			else f[len]=com(len-1,last-1)*qpow(25,len-last)%mod*qpow(26,q[i].bas-len)%mod;
			pre[len]=pre[len-1]+f[len];
		}
		ans[q[i].id]=pre[len];
	}
	for(i=1;i<=qtop;i++){
		printf("%lld\n",ans[i]);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int qtop;
struct event{
	int cur,bas,id;
	bool operator<(const event &ob)const{
		if(cur!=ob.cur) return cur<ob.cur;
		return bas<ob.bas;
	}
}q[100010];
long long ans[100010],f[100010],pre[100010];
const long long mod=1e9+7;
long long fac[100010],facinv[100010],inv[100010];
long long com(int n,int k){
	return fac[n]*facinv[k]%mod*facinv[n-k]%mod;
}
long long qpow(long long base,int index){
	if(index<=0) return 1;
	if(index==1) return base;
	long long t=qpow(base,index>>1);
	if(index&1) return t*t%mod*base%mod;
	else return t*t%mod;
}
long long p25[100010],p26[100010];
int main(){
	int m;
	scanf("%d",&m);
	scanf("%s",s);
	int len=strlen(s);
	int i,op,temp;
	p25[0]=p26[0]=1;
	for(i=1;i<=100000;i++){
		p25[i]=(p25[i-1]*25)%mod;
		p26[i]=(p26[i-1]*26)%mod;
	}
	fac[0]=facinv[0]=inv[0]=1;
	fac[1]=facinv[1]=inv[1]=1;
	for(i=2;i<=100000;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		facinv[i]=facinv[i-1]*inv[i]%mod;
	}
	for(i=0;i<m;i++){
		scanf("%d",&op);
		if(op==1){
			scanf("%s",s);
			len=strlen(s);
		}
		else{
			scanf("%d",&temp);
			qtop++;
			q[qtop]=(event){len,temp,qtop};
		}
	}
	sort(q+1,q+qtop+1);
	int last=0;
	for(i=1;i<=qtop;i++){
		if(q[i].cur!=last){
			last=q[i].cur;
			pre[last-1]=0;
			len=last-1;
		}
		if(len<q[i].bas){
			pre[len]=pre[len]*p26[q[i].bas-len]%mod;
		}
		while(len<q[i].bas){
			len++;
			f[len]=com(len-1,last-1)*p25[len-last]%mod*p26[q[i].bas-len]%mod;
			pre[len]=(pre[len-1]+f[len])%mod;
		}
		ans[q[i].id]=pre[len];
	}
	for(i=1;i<=qtop;i++){
		printf("%lld\n",ans[i]);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int qtop;
struct event{
	int cur,bas,id;
	bool operator<(const event &ob)const{
		if(cur!=ob.cur) return cur<ob.cur;
		return bas<ob.bas;
	}
}q[100010];
long long ans[100010],f[100010],pre[100010];
const long long mod=1e9+7;
long long fac[100010],facinv[100010],inv[100010];
long long com(int n,int k){
	return fac[n]*facinv[k]%mod*facinv[n-k]%mod;
}
long long qpow(long long base,int index){
	if(index<=0) return 1;
	if(index==1) return base;
	long long t=qpow(base,index>>1);
	if(index&1) return t*t%mod*base%mod;
	else return t*t%mod;
}
int main(){
	int m;
	scanf("%d",&m);
	scanf("%s",s);
	int len=strlen(s);
	int i,op,temp;
	fac[0]=facinv[0]=inv[0]=1;
	fac[1]=facinv[1]=inv[1]=1;
	for(i=2;i<=100000;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		facinv[i]=facinv[i-1]*inv[i]%mod;
	}
	for(i=0;i<m;i++){
		scanf("%d",&op);
		if(op==1){
			scanf("%s",s);
			len=strlen(s);
		}
		else{
			scanf("%d",&temp);
			qtop++;
			q[qtop]=(event){len,temp,qtop};
		}
	}
	sort(q+1,q+qtop+1);
	int last=0;
	for(i=1;i<=qtop;i++){
		if(q[i].cur!=last){
			last=q[i].cur;
			len=last-1;
		}
		if(len<q[i].bas){
			pre[len]=pre[len]*qpow(26,q[i].bas-len)%mod;
		}
		while(len<q[i].bas){
			len++;
			f[len]=com(len-1,last-1)*qpow(25,len-last)%mod*qpow(26,q[i].bas-len)%mod;
			pre[len]=(pre[len-1]+f[len])%mod;
		}
		ans[q[i].id]=pre[len];
	}
	for(i=1;i<=qtop;i++){
		printf("%lld\n",ans[i]);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int qtop;
struct event{
	int cur,bas,id;
	bool operator<(const event &ob)const{
		if(cur!=ob.cur) return cur<ob.cur;
		return bas<ob.bas;
	}
}q[100010];
long long ans[100010],f[100010],pre[100010];
const long long mod=1e9+7;
long long fac[100010],facinv[100010],inv[100010];
long long com(int n,int k){
	return fac[n]*facinv[k]%mod*facinv[n-k]%mod;
}
long long qpow(long long base,int index){
	if(index<=0) return 1;
	if(index==1) return base;
	long long t=qpow(base,index>>1);
	if(index&1) return t*t%mod*base%mod;
	else return t*t%mod;
}
int main(){
	int m;
	scanf("%d",&m);
	scanf("%s",s);
	int len=strlen(s);
	int i,op,temp;
	fac[0]=facinv[0]=inv[0]=1;
	fac[1]=facinv[1]=inv[1]=1;
	for(i=2;i<=100000;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		facinv[i]=facinv[i-1]*inv[i]%mod;
	}
	for(i=0;i<m;i++){
		scanf("%d",&op);
		if(op==1){
			scanf("%s",s);
			len=strlen(s);
		}
		else{
			scanf("%d",&temp);
			qtop++;
			q[qtop]=(event){len,temp,qtop};
		}
	}
	sort(q+1,q+qtop+1);
	int last=0;
	for(i=1;i<=qtop;i++){
		if(q[i].cur!=last){
			last=q[i].cur;
			memset(pre,0,last+1<<2);
			len=last-1;
		}
		if(len<q[i].bas){
			pre[len]=pre[len]*qpow(26,q[i].bas-len)%mod;
		}
		while(len<q[i].bas){
			len++;
			f[len]=com(len-1,last-1)*qpow(25,len-last)%mod*qpow(26,q[i].bas-len)%mod;
			pre[len]=(pre[len-1]+f[len])%mod;
		}
		ans[q[i].id]=pre[len];
	}
	for(i=1;i<=qtop;i++){
		printf("%lld\n",ans[i]);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int qtop;
struct event{
	int cur,bas,id;
	bool operator<(const event &ob)const{
		if(cur!=ob.cur) return cur<ob.cur;
		return bas<ob.bas;
	}
}q[100010];
long long ans[100010],f[100010],pre[100010];
const long long mod=1e9+7;
long long fac[100010],facinv[100010],inv[100010];
long long com(int n,int k){
	return fac[n]*facinv[k]%mod*facinv[n-k]%mod;
}
long long qpow(long long base,int index){
	if(index<=0) return 1;
	if(index==1) return base;
	long long t=qpow(base,index>>1);
	if(index&1) return t*t%mod*base%mod;
	else return t*t%mod;
}
int main(){
	int m;
	scanf("%d",&m);
	scanf("%s",s);
	int len=strlen(s);
	int i,op,temp;
	fac[0]=facinv[0]=inv[0]=1;
	fac[1]=facinv[1]=inv[1]=1;
	for(i=2;i<=100000;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		facinv[i]=facinv[i-1]*inv[i]%mod;
	}
	for(i=0;i<m;i++){
		scanf("%d",&op);
		if(op==1){
			scanf("%s",s);
			len=strlen(s);
		}
		else{
			scanf("%d",&temp);
			qtop++;
			q[qtop]=(event){len,temp,qtop};
		}
	}
//	sort(q+1,q+qtop+1);
	int last=0;
	for(i=1;i<=qtop;i++){
		if(q[i].cur!=last){
			last=q[i].cur;
			pre[last-1]=0;
			len=last-1;
		}
		if(len<q[i].bas){
			pre[len]=pre[len]*qpow(26,q[i].bas-len)%mod;
		}
		while(len<q[i].bas){
			len++;
			f[len]=com(len-1,last-1)*qpow(25,len-last)%mod*qpow(26,q[i].bas-len)%mod;
			pre[len]=(pre[len-1]+f[len])%mod;
		}
		ans[q[i].id]=pre[len];
	}
	for(i=1;i<=qtop;i++){
		printf("%lld\n",ans[i]);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[100010];
int qtop;
struct event{
	int cur,bas,id;
	bool operator<(const event &ob)const{
		if(cur!=ob.cur) return cur<ob.cur;
		return bas<ob.bas;
	}
}q[100010];
long long ans[100010],f[100010],pre[100010];
const long long mod=1e9+7;
long long fac[100010],facinv[100010],inv[100010];
long long com(int n,int k){
	return fac[n]*facinv[k]%mod*facinv[n-k]%mod;
}
long long qpow(long long base,int index){
	if(index<=0) return 1;
	if(index==1) return base;
	long long t=qpow(base,index>>1);
	if(index&1) return t*t%mod*base%mod;
	else return t*t%mod;
}
int main(){
	int m;
	scanf("%d",&m);
	scanf("%s",s);
	int len=strlen(s);
	int i,op,temp;
	fac[0]=facinv[0]=inv[0]=1;
	fac[1]=facinv[1]=inv[1]=1;
	for(i=2;i<=100000;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		facinv[i]=facinv[i-1]*inv[i]%mod;
	}
	for(i=0;i<m;i++){
		scanf("%d",&op);
		if(op==1){
			scanf("%s",s);
			len=strlen(s);
		}
		else{
			scanf("%d",&temp);
			qtop++;
			q[qtop]=(event){len,temp,qtop};
		}
	}
	sort(q+1,q+qtop+1);
	int last=0;
	for(i=1;i<=qtop;i++){
		if(q[i].cur!=last){
			last=q[i].cur;
			len=0;
		}
		if(len<q[i].bas){
			pre[len]=pre[len]*qpow(26,q[i].bas-len)%mod;
		}
		while(len<q[i].bas){
			len++;
			if(len<last) f[len]=0;
			else f[len]=com(len-1,last-1)*qpow(25,len-last)%mod*qpow(26,q[i].bas-len)%mod;
			pre[len]=(pre[len-1]+f[len])%mod;
		}
		ans[q[i].id]=pre[len];
	}
	for(i=1;i<=qtop;i++){
		printf("%lld\n",ans[i]);
	}
	return 0;
}


#include <bits/stdc++.h>
#define MAXN 100005
using namespace std;

const long long M=1e9+7;

int T,n,now,o,x;
char s[MAXN];
long long ans[MAXN],inv[MAXN],fac[MAXN],invfac[MAXN],f[MAXN],_25[MAXN];
vector <pair<int,int> > q[MAXN];

inline void Init()
{
	int n=1e5;inv[1]=fac[0]=invfac[0]=_25[0]=1LL;
	for (int i=1;i<=n;i++) fac[i]=fac[i-1]*i%M;
	for (int i=2;i<=n;i++) inv[i]=(M-M/i)*inv[M%i]%M;
	for (int i=1;i<=n;i++) invfac[i]=invfac[i-1]*inv[i]%M;
	for (int i=1;i<=n;i++) _25[i]=_25[i-1]*25%M;
	return ;
}

inline long long C(int n,int m)
{
	return fac[n]*invfac[m]%M*invfac[n-m]%M;
}

inline void Calc(int s,int n)
{
	for (int i=0;i<s;i++) f[i]=0;f[s]=1;
	for (int i=s+1;i<=n;i++)
		f[i]=(26*f[i-1]%M+C(i-1,s-1)*_25[i-s]%M)%M;
	return ;
}

int main()
{
	Init();
	scanf("%d",&T);scanf("%s",s);now=strlen(s);
	for (int i=1;i<=T;i++)
	{
		scanf("%d",&o);
		if (o==1)
		{
			scanf("%s",s);now=strlen(s);
		}
		else
		{
			scanf("%d",&x);q[now].push_back({x,++n});
		}
	}
	for (int i=1;i<=100000;i++)
	{
		if (!q[i].size()) continue;
		sort(q[i].begin(),q[i].end());
		Calc(i,q[i].back().first);
		for (auto j:q[i]) ans[j.second]=f[j.first];
	}
	for (int i=1;i<=n;i++) printf("%lld\n",ans[i]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <int , int> pii;

const int N = 1e5+10 , mod = 1e9+7 , SQ = 500;

int ans[N][SQ] , pw[N] , rev[N] , fac[N];

inline int p(int x , int y){
   int ret = 1;
   for( ; y ; y /= 2){
      if(y & 1)
         ret = 1ll * ret * x % mod;
      x = 1ll * x * x % mod;
   }
   return ret;
}

inline int c(int x , int y){
   return 1ll * fac[y] * rev[x] % mod * rev[y - x] % mod;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   pw[0] = 1;
   fac[0] = 1;
   rev[0] = 1;
   for(int i = 1 ; i < N ; i++){
      fac[i] = 1ll * fac[i - 1] * i % mod;
      pw[i] = 1ll * pw[i - 1] * 25 % mod;
      rev[i] = p(fac[i] , mod - 2);
   }
   int m;
   cin >> m;
   int t[m + 1];
   int l[m + 1];
   vector <int> len;
   string st;
   cin >> st;
   l[0] = st.length();
   int ask[m + 1];
   memset(ask , -1 , sizeof(ask));
   len.push_back(l[0]);
   for(int i = 1 ; i <= m ; i++){
      cin >> t[i];
      if(t[i] == 1){
         string s;
         cin >> s;
         l[i] = s.length();
         len.push_back(l[i]);
      }
      else{
         l[i] = l[i - 1];
         cin >> ask[i];
      }
   }
   sort(len.begin() , len.end());
   len.resize(unique(len.begin() , len.end()) - len.begin());
   for(int i = 1 ; i < N ; i++){
      for(int j = 0 ; j < len.size() && len[j] <= i ; j++){
         ans[i][j] = (1ll * 26 * ans[i - 1][j] % mod + 1ll * c(len[j] - 1 , i - 1) * pw[i - len[j]] % mod) % mod;
      }
   }
   for(int i = 1 ; i <= m ; i++){
      if(ask[i] != -1){
         int id = lower_bound(len.begin() , len.end() , l[i]) - len.begin();
         cout << ans[ask[i]][id] << "\n";
      }
   }
   return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 310000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 100100;
mint sum[300][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 110000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 100100;
int sum[350][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = (sum[jupi][i] + (t[i] * COM(i + len - 1, i)).x) % mod;
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = rui2[len] * sum[idx][len + 1];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 210000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 100100;
mint sum[330][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 310000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 100100;
mint sum[300][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 310000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 200000;
mint sum[300][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 210000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 100100;
int sum[500][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	if (v.size() >= 350) {
		cout << v.size() << endl;
		exit(1);
	}
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i + len - 1 <= k; i++) {
			sum[jupi][i + 1] = (sum[jupi][i] + (t[i] * COM(i + len - 1, i)).x) % mod;
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = rui2[len] * sum[idx][len + 1];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 310000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 100100;
mint sum[300][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	if (v.size() >= 300) {
		cerr << "kkt" << endl;
		exit(1);
	}
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 310000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 100100;
mint sum[200][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	constexpr int k = 200000;
	COMinit();
	vector<mint> rui1(k + 1), rui2(k + 1), t(k + 1);
	rui1[0] = 1; for (int i = 1; i <= k; i++) rui1[i] = rui1[i - 1] * 25;
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	vector<vector<mint>> sum(v.size(), vector<mint>(k + 2));
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 310000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	constexpr int k = 200000;
	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	vector<vector<mint>> sum(v.size(), vector<mint>(k + 2));
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

constexpr long long MAX = 210000;
struct mint {
	long long x;
	mint(long long x = 0) :x((x% mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
int fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = 1LL * fac[i - 1] * i % mod;
		inv[i] = mod - 1LL * inv[mod % i] * (mod / i) % mod;
		finv[i] = 1LL * finv[i - 1] * inv[i] % mod;
	}
}

mint COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return mint(fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}

mint LCOM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k > n / 2) k = n - k;
	mint res = 1;
	for (int i = 0; i < k; i++) res *= (n - i);
	res *= finv[k];
	return res;
}

constexpr int k = 100100;
mint sum[330][k + 2];
int main()
{

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

	COMinit();
	vector<mint> rui2(k + 1), t(k + 1);
	rui2[0] = 1; for (int i = 1; i <= k; i++) rui2[i] = rui2[i - 1] * 26;
	mint inv = mint(26).inv() * 25;
	t[0] = 1; for (int i = 1; i <= k; i++) t[i] = t[i - 1] * inv;
	int kkt; cin >> kkt;
	string s;
	cin >> s;
	int slen = s.size();
	vector<pair<int, int>> tp;
	vector<int> v;
	for (int i = 0; i < kkt; i++) {
		int q; cin >> q;
		if (q == 1) {
			string s; cin >> s;
			tp.emplace_back(q, s.size());
			v.emplace_back(s.size());
		}
		else {
			int n; cin >> n;
			tp.emplace_back(q, n);
		}
	}
	v.emplace_back(s.size());
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for (int jupi = 0; jupi < v.size(); jupi++) {
		int len = v[jupi];
		for (int i = 0; i <= k; i++) {
			sum[jupi][i + 1] = sum[jupi][i] + t[i] * COM(i + len - 1, i);
		}
	}
	for (auto &p : tp) {
		if (p.first == 1) {
			slen = p.second;
		}
		else {
			int n = p.second;
			int len = n - slen;
			if (len < 0) {
				cout << 0 << "\n";
				continue;
			}
			int idx = lower_bound(v.begin(), v.end(), slen) - v.begin();
			mint res = sum[idx][len + 1] * rui2[len];
			cout << res.x << "\n";
		}
	}
    return 0;
}