#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;
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());
	if (v.size() >= 300) {
		cout << v.size() << 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 = 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;
mint sum[320][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[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());
	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[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 = 200000;
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;
			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() >= 500) {
		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 = 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[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());
	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 = 200000;
mint sum[150][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 <bits/stdc++.h>
using namespace std;
const int P = 1000000007;
const int N = 100001;
const int S = 320;

int add(int a, int b) { a += b; return a < P ? a : a - P; }
int sub(int a, int b) { a -= b; return a < 0 ? a + P : a; }
int mul(long long a, long long b) { return a * b % P; }
int qpm(int a, int b) {
    int r = 1;
    do if (b & 1) r = mul(r, a);
    while (a = mul(a, a), b >>= 1);
    return r;
}
int inv(int x) { return qpm(x, P - 2); }

int fac[N], ifac[N], invs[N];
void ginv() {
    invs[1] = 1; for (int i = 2; i < N; ++i) invs[i] = mul(invs[P % i], P - P / i);
    fac[0] = 1; for (int i = 1; i < N; ++i) fac[i] = mul(fac[i - 1], i);
    ifac[0] = 1; for (int i = 1; i < N; ++i) ifac[i] = mul(ifac[i - 1], invs[i]);
}
int bi(int n, int k) { return n < k ? 0 : mul(fac[n], mul(ifac[k], ifac[n - k])); }

int pq[N];
char str[N];

vector<int> res[N];

int read_and_build() {
    scanf("%s", str);
    int k = strlen(str);
    if (res[k].empty()) {
        res[k].assign(N, 0);
        for (int i = k; i != N; ++i)
            res[k][i] = add(res[k][i - 1], mul(bi(i - 1, k - 1), pq[i]));
    }
    return k;
}

int main(void) {
    ginv();
    const int q = mul(25, inv(26));
    for (int i = pq[0] = 1; i < N; ++i) pq[i] = mul(pq[i - 1], q);

    int m; scanf("%d", &m);
    int k = read_and_build();
    while (m--) {
        int t; scanf("%d", &t);
        if (t == 1)
            k = read_and_build();
        else {
            int n; scanf("%d", &n);
            int ans = 0;
            if (n >= k)
                ans = mul(res[k][n], mul(qpm(26, n), qpm(inv(25), k)));
            printf("%d\n", ans);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int P = 1000000007;
const int N = 200001;
const int S = 320;

int add(int a, int b) { a += b; return a < P ? a : a - P; }
int sub(int a, int b) { a -= b; return a < 0 ? a + P : a; }
int mul(long long a, long long b) { return a * b % P; }
int qpm(int a, int b) {
    int r = 1;
    do if (b & 1) r = mul(r, a);
    while (a = mul(a, a), b >>= 1);
    return r;
}
int inv(int x) { return qpm(x, P - 2); }

int fac[N], ifac[N], invs[N];
void ginv() {
    invs[1] = 1; for (int i = 2; i < N; ++i) invs[i] = mul(invs[P % i], P - P / i);
    fac[0] = 1; for (int i = 1; i < N; ++i) fac[i] = mul(fac[i - 1], i);
    ifac[0] = 1; for (int i = 1; i < N; ++i) ifac[i] = mul(ifac[i - 1], invs[i]);
}
int bi(int n, int k) { return n < k ? 0 : mul(fac[n], mul(ifac[k], ifac[n - k])); }

int lp[N], ls[N];
int lintp(const vector<int>& y, int x) {
    int n = y.size(), res = 0; lp[0] = x; ls[n - 1] = sub(x, n - 1);
    for (int i = 1; i != n; ++i) lp[i] = mul(lp[i - 1], (x - i));
    for (int i = n - 2; i >= 0; --i) ls[i] = mul(ls[i + 1], (x - i));
    for (int i = 0; i != n; ++i) {
        int t = (n - i + 1) & 1 ? P - y[i] : y[i];
        if (i)          t = mul(t, mul(lp[i - 1], ifac[i]));
        if (i != n - 1) t = mul(t, mul(ls[i + 1], ifac[n - 1 - i]));
        res = add(res, t);
    }
    return res;
}

const int q = mul(25, inv(26));
int pq[N], piq[N], pq_1[N], piq_1[N], p1_q[N], pi1_q[N];
void gpi(int* p, int* pi, int x) {
    for (int i = p[0] = 1; i < N; ++i) p[i] = mul(p[i - 1], x);
    x = inv(x);
    for (int i = pi[0] = 1; i < N; ++i) pi[i] = mul(pi[i - 1], x);
}
void init() {
    gpi(pq, piq, q);
    gpi(pq_1, piq_1, sub(q, 1));
    gpi(p1_q, pi1_q, sub(1, q));
}

int cal_f(int g, int n, int k) {
    return mul(mul(piq[n], pq_1[k]), sub(g, mul(pq[k], pi1_q[k])));
}
int cal_g(int f, int n, int k) {
    return add(mul(f, mul(pq[n], piq_1[k])), mul(pq[k], pi1_q[k]));
}

int gs[S];  //  gs[i] = g[k + i * S]
void cal_gs(int k) {
    vector<int> y;
    int g = 0;
    for (int i = k - 1; i <= 2 * k + 1; ++i) {
        g = add(g, mul(bi(i - 1, k - 1), pq[i]));
        y.push_back(cal_f(g, i, k));
    }
    for (int i = 0; i != S; ++i) {
        int x = i * S + k, f = lintp(y, i * S + 1);
        gs[i] = cal_g(f, x, k);
    }
}

int query_g(int n, int k) {
    int t = (n - k) / S, g = gs[t];
    for (int i = k + t * S + 1; i <= n; ++i)
        g = add(g, mul(bi(i - 1, k - 1), pq[i]));
    return g;
}

char str[N];

int read_and_build() {
    scanf("%s", str);
    int k = strlen(str);
    cal_gs(k);
    return k;
}

int main(void) {
    ginv();
    init();
    int m; scanf("%d", &m);
    int k = read_and_build();
    while (m--) {
        int t; scanf("%d", &t);
        if (t == 1)
            k = read_and_build();
        else {
            int n; scanf("%d", &n);
            int res;
            if (n < k) res = 0;
            else res = mul(query_g(n, k), mul(qpm(26, n), qpm(inv(25), k)));
            printf("%d\n", res);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int P = 1000000007;
const int N = 200001;
const int S = 320;

int add(int a, int b) { a += b; return a < P ? a : a - P; }
int sub(int a, int b) { a -= b; return a < 0 ? a + P : a; }
int mul(long long a, long long b) { return a * b % P; }
int qpm(int a, int b) {
    int r = 1;
    do if (b & 1) r = mul(r, a);
    while (a = mul(a, a), b >>= 1);
    return r;
}
int inv(int x) { return qpm(x, P - 2); }

int fac[N], ifac[N], invs[N];
void ginv() {
    invs[1] = 1; for (int i = 2; i < N; ++i) invs[i] = mul(invs[P % i], P - P / i);
    fac[0] = 1; for (int i = 1; i < N; ++i) fac[i] = mul(fac[i - 1], i);
    ifac[0] = 1; for (int i = 1; i < N; ++i) ifac[i] = mul(ifac[i - 1], invs[i]);
}
int bi(int n, int k) { return mul(fac[n], mul(ifac[k], ifac[n - k])); }

int lp[N], ls[N];
int lintp(const vector<int>& y, int x) {
    int n = y.size(), res = 0; lp[0] = x; ls[n - 1] = sub(x, n - 1);
    for (int i = 1; i != n; ++i) lp[i] = mul(lp[i - 1], (x - i));
    for (int i = n - 2; i >= 0; --i) ls[i] = mul(ls[i + 1], (x - i));
    for (int i = 0; i != n; ++i) {
        int t = (n - i + 1) & 1 ? P - y[i] : y[i];
        if (i)          t = mul(t, mul(lp[i - 1], ifac[i]));
        if (i != n - 1) t = mul(t, mul(ls[i + 1], ifac[n - 1 - i]));
        res = add(res, t);
    }
    return res;
}

const int q = mul(25, inv(26));
int pq[N], piq[N], pq_1[N], piq_1[N], p1_q[N], pi1_q[N];
void gpi(int* p, int* pi, int x) {
    for (int i = p[0] = 1; i < N; ++i) p[i] = mul(p[i - 1], x);
    x = inv(x);
    for (int i = pi[0] = 1; i < N; ++i) pi[i] = mul(pi[i - 1], x);
}
void init() {
    gpi(pq, piq, q);
    gpi(pq_1, piq_1, sub(q, 1));
    gpi(p1_q, pi1_q, sub(1, q));
}

int cal_f(int g, int n, int k) {
    return mul(mul(piq[n], pq_1[k]), sub(g, mul(pq[k], pi1_q[k])));
}
int cal_g(int f, int n, int k) {
    return add(mul(f, mul(pq[n], piq_1[k])), mul(pq[k], pi1_q[k]));
}

int gs[S];  //  gs[i] = g[k + i * S]
void cal_gs(int k) {
    vector<int> y;
    int g = 0;
    for (int i = k - 1; i <= 2 * k + 1; ++i) {
        g = add(g, mul(bi(i - 1, k - 1), pq[i]));
        y.push_back(cal_f(g, i, k));
    }
    for (int i = 0; i != S; ++i) {
        int x = i * S + k, f = lintp(y, i * S + 1);
        gs[i] = cal_g(f, x, k);
    }
}

int query_g(int n, int k) {
    int t = (n - k) / S, g = gs[t];
    for (int i = k + t * S + 1; i <= n; ++i)
        g = add(g, mul(bi(i - 1, k - 1), pq[i]));
    return g;
}

char str[N];

int read_and_build() {
    scanf("%s", str);
    int k = strlen(str);
    cal_gs(k);
    return k;
}

int main(void) {
    ginv();
    init();
    int m; scanf("%d", &m);
    int k = read_and_build();
    while (m--) {
        int t; scanf("%d", &t);
        if (t == 1)
            k = read_and_build();
        else {
            int n; scanf("%d", &n);
            int res = mul(query_g(n, k), mul(qpm(26, n), qpm(inv(25), k)));
            printf("%d\n", res);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int P = 1000000007;
const int N = 200001;
const int S = 320;

int add(int a, int b) { a += b; return a < P ? a : a - P; }
int sub(int a, int b) { a -= b; return a < 0 ? a + P : a; }
int mul(long long a, long long b) { return a * b % P; }
int qpm(int a, int b) {
    int r = 1;
    do if (b & 1) r = mul(r, a);
    while (a = mul(a, a), b >>= 1);
    return r;
}
int inv(int x) { return qpm(x, P - 2); }

int fac[N], ifac[N], invs[N];
void ginv() {
    invs[1] = 1; for (int i = 2; i < N; ++i) invs[i] = mul(invs[P % i], P - P / i);
    fac[0] = 1; for (int i = 1; i < N; ++i) fac[i] = mul(fac[i - 1], i);
    ifac[0] = 1; for (int i = 1; i < N; ++i) ifac[i] = mul(ifac[i - 1], invs[i]);
}
int bi(int n, int k) { return n < k ? 0 : mul(fac[n], mul(ifac[k], ifac[n - k])); }

int lp[N], ls[N];
int lintp(const vector<int>& y, int x) {
    int n = y.size(), res = 0; lp[0] = x; ls[n - 1] = sub(x, n - 1);
    for (int i = 1; i != n; ++i) lp[i] = mul(lp[i - 1], (x - i));
    for (int i = n - 2; i >= 0; --i) ls[i] = mul(ls[i + 1], (x - i));
    for (int i = 0; i != n; ++i) {
        int t = (n - i + 1) & 1 ? P - y[i] : y[i];
        if (i)          t = mul(t, mul(lp[i - 1], ifac[i]));
        if (i != n - 1) t = mul(t, mul(ls[i + 1], ifac[n - 1 - i]));
        res = add(res, t);
    }
    return res;
}

const int q = mul(25, inv(26));
int pq[N], piq[N], pq_1[N], piq_1[N], p1_q[N], pi1_q[N];
void gpi(int* p, int* pi, int x) {
    for (int i = p[0] = 1; i < N; ++i) p[i] = mul(p[i - 1], x);
    x = inv(x);
    for (int i = pi[0] = 1; i < N; ++i) pi[i] = mul(pi[i - 1], x);
}
void init() {
    gpi(pq, piq, q);
    gpi(pq_1, piq_1, sub(q, 1));
    gpi(p1_q, pi1_q, sub(1, q));
}

int cal_f(int g, int n, int k) {
    return mul(mul(piq[n], pq_1[k]), sub(g, mul(pq[k], pi1_q[k])));
}
int cal_g(int f, int n, int k) {
    return add(mul(f, mul(pq[n], piq_1[k])), mul(pq[k], pi1_q[k]));
}

int gs[S];  //  gs[i] = g[k + i * S]
void cal_gs(int k) {
    vector<int> y;
    int g = 0;
    for (int i = k - 1; i <= 2 * k + 1; ++i) {
        g = add(g, mul(bi(i - 1, k - 1), pq[i]));
        y.push_back(cal_f(g, i, k));
    }
    for (int i = 0; i != S; ++i) {
        int x = i * S + k, f = lintp(y, i * S + 1);
        gs[i] = cal_g(f, x, k);
    }
}

int query_g(int n, int k) {
    int t = (n - k) / S, g = gs[t];
    for (int i = k + t * S + 1; i <= n; ++i)
        g = add(g, mul(bi(i - 1, k - 1), pq[i]));
    return g;
}

char str[N];

int read_and_build() {
    scanf("%s", str);
    int k = strlen(str);
    cal_gs(k);
    return k;
}

int main(void) {
    ginv();
    init();
    int m; scanf("%d", &m);
    int k = read_and_build();
    while (m--) {
        int t; scanf("%d", &t);
        if (t == 1)
            k = read_and_build();
        else {
            int n; scanf("%d", &n);
            int res = mul(query_g(n, k), mul(qpm(26, n), qpm(inv(25), k)));
            printf("%d\n", res);
        }
    }
    return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const ll MOD = 1000000007LL;
const int MAX_N = 100005;
const ll K = 25;

ll fact[MAX_N];
ll invFact[MAX_N];
ll kPow[MAX_N];

map<int, vector<pair<ll, int>>> reqByM;
ll result[MAX_N];

ll binPow(ll a, ll x)
{
	if (x == 0)
		return 1LL;
	if (x % 2 != 0)
		return (a * binPow(a, x - 1)) % MOD;
	ll halfPow = binPow(a, x / 2LL);
	return (halfPow * halfPow) % MOD;
}

inline void precalc()
{
	fact[0] = 1LL;
	for (ll i = 1; i < MAX_N; i++)
		fact[i] = (fact[i - 1] * i) % MOD;
	for (int i = 0; i < MAX_N; i++)
		invFact[i] = binPow(fact[i], MOD - 2LL);
	kPow[0] = 1LL;
	for (int i = 1; i < MAX_N; i++)
		kPow[i] = (kPow[i - 1] * K) % MOD;
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	precalc();

	int q; cin >> q;
	string s; cin >> s;
	int m = (int)s.length();
	int req2 = 0;
	while (q--)
	{
		int type; cin >> type;
		if (type == 1)
		{
			cin >> s;
			m = (int)s.length();
		}
		else
		{
			int n; cin >> n;
			reqByM[m].emplace_back(n, req2++);
		}
	}

	for (const auto& p : reqByM)
	{
		m = p.first;
		int it = 0;
		while (it < (int)p.second.size() && p.second[it].first < m)
			it++;
		while (it < (int)p.second.size() && p.second[it].first == m)
		{
			result[p.second[it].second] = 1;
			it++;
		}

		ll res = 1, nextRes;
		for (ll n = m + 1; it < (int)p.second.size(); n++)
		{
			nextRes = (((fact[n - 1] * invFact[n - m]) % MOD) * invFact[m - 1]) % MOD;
			nextRes = (nextRes * kPow[n - m]) % MOD;
			nextRes = (nextRes + (K + 1LL) * res) % MOD;
			res = nextRes;

			while (it < (int)p.second.size() && p.second[it].first == n)
			{
				result[p.second[it].second] = res;
				it++;
			}
		}
	}

	for (int i = 0; i < req2; i++)
		cout << result[i] << '\n';

	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const ll MOD = 1000000007LL;
const int MAX_N = 200005;
const ll K = 25;

ll fact[MAX_N];
ll invFact[MAX_N];
ll kPow[MAX_N];

map<int, vector<pair<ll, int>>> reqByM;
ll result[MAX_N];

ll binPow(ll a, ll x)
{
	if (x == 0)
		return 1LL;
	if (x % 2 != 0)
		return (a * binPow(a, x - 1)) % MOD;
	ll halfPow = binPow(a, x / 2LL);
	return (halfPow * halfPow) % MOD;
}

inline void precalc()
{
	fact[0] = 1LL;
	for (ll i = 1; i < MAX_N; i++)
		fact[i] = (fact[i - 1] * i) % MOD;
	for (int i = 0; i < MAX_N; i++)
		invFact[i] = binPow(fact[i], MOD - 2LL);
	kPow[0] = 1LL;
	for (int i = 1; i < MAX_N; i++)
		kPow[i] = (kPow[i - 1] * K) % MOD;
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	precalc();

	int q; cin >> q;
	string s; cin >> s;
	int m = (int)s.length();
	int req2 = 0;
	while (q--)
	{
		int type; cin >> type;
		if (type == 1)
		{
			cin >> s;
			m = (int)s.length();
		}
		else
		{
			int n; cin >> n;
			reqByM[m].emplace_back(n, req2++);
		}
	}

	for (const auto& p : reqByM)
	{
		m = p.first;
		int it = 0;
		while (it < (int)p.second.size() && p.second[it].first < m)
			it++;
		while (it < (int)p.second.size() && p.second[it].first == m)
		{
			result[p.second[it].second] = 1;
			it++;
		}

		ll res = 1, nextRes;
		for (ll n = m + 1; it < (int)p.second.size(); n++)
		{
			nextRes = (((fact[n - 1] * invFact[n - m]) % MOD) * invFact[m - 1]) % MOD;
			nextRes = (nextRes * kPow[n - m]) % MOD;
			nextRes = (nextRes + (K + 1LL) * res) % MOD;
			res = nextRes;

			while (it < (int)p.second.size() && p.second[it].first == n)
			{
				result[p.second[it].second] = res;
				it++;
			}
		}
	}

	for (int i = 0; i < req2; i++)
		cout << result[i] << '\n';

	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const ll MOD = 1000000007LL;
const int MAX_N = 100005;
const ll K = 25;

ll fact[MAX_N];
ll invFact[MAX_N];
ll kPow[MAX_N];

map<int, vector<pair<ll, int>>> reqByM;
ll result[MAX_N];

ll binPow(ll a, ll x)
{
	if (x == 0)
		return 1LL;
	if (x % 2 != 0)
		return (a * binPow(a, x - 1)) % MOD;
	ll halfPow = binPow(a, x / 2LL);
	return (halfPow * halfPow) % MOD;
}

inline void precalc()
{
	fact[0] = 1LL;
	for (ll i = 1; i < MAX_N; i++)
		fact[i] = (fact[i - 1] * i) % MOD;
	for (int i = 0; i < MAX_N; i++)
		invFact[i] = binPow(fact[i], MOD - 2LL);
	kPow[0] = 1LL;
	for (int i = 1; i < MAX_N; i++)
		kPow[i] = (kPow[i - 1] * K) % MOD;
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	precalc();

	int q; cin >> q;
	string s; cin >> s;
	int m = (int)s.length();
	int req2 = 0;
	while (q--)
	{
		int type; cin >> type;
		if (type == 1)
		{
			cin >> s;
			m = (int)s.length();
		}
		else
		{
			int n; cin >> n;
			reqByM[m].emplace_back(n, req2++);
		}
	}

	for (const auto& p : reqByM)
	{
		sort(p.second.begin(), p.second.end());
		m = p.first;
		int it = 0;
		while (it < (int)p.second.size() && p.second[it].first < m)
			it++;
		while (it < (int)p.second.size() && p.second[it].first == m)
		{
			result[p.second[it].second] = 1;
			it++;
		}

		ll res = 1, nextRes;
		for (ll n = m + 1; it < (int)p.second.size(); n++)
		{
			nextRes = (((fact[n - 1] * invFact[n - m]) % MOD) * invFact[m - 1]) % MOD;
			nextRes = (nextRes * kPow[n - m]) % MOD;
			nextRes = (nextRes + (K + 1LL) * res) % MOD;
			res = nextRes;

			while (it < (int)p.second.size() && p.second[it].first == n)
			{
				result[p.second[it].second] = res;
				it++;
			}
		}
	}

	for (int i = 0; i < req2; i++)
		cout << result[i] << '\n';

	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const ll MOD = 1000000007LL;
const int MAX_N = 100005;
const ll K = 25;

ll fact[MAX_N];
ll invFact[MAX_N];
ll kPow[MAX_N];

map<int, vector<pair<ll, int>>> reqByM;
ll result[MAX_N];

ll binPow(ll a, ll x)
{
	if (x == 0)
		return 1LL;
	if (x % 2 != 0)
		return (a * binPow(a, x - 1)) % MOD;
	ll halfPow = binPow(a, x / 2LL);
	return (halfPow * halfPow) % MOD;
}

inline void precalc()
{
	fact[0] = 1LL;
	for (ll i = 1; i < MAX_N; i++)
		fact[i] = (fact[i - 1] * i) % MOD;
	for (int i = 0; i < MAX_N; i++)
		invFact[i] = binPow(fact[i], MOD - 2LL);
	kPow[0] = 1LL;
	for (int i = 1; i < MAX_N; i++)
		kPow[i] = (kPow[i - 1] * K) % MOD;
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	precalc();

	int q; cin >> q;
	string s; cin >> s;
	int m = (int)s.length();
	int req2 = 0;
	while (q--)
	{
		int type; cin >> type;
		if (type == 1)
		{
			cin >> s;
			m = (int)s.length();
		}
		else
		{
			int n; cin >> n;
			reqByM[m].emplace_back(n, req2++);
		}
	}

	for (auto& p : reqByM)
	{
		sort(p.second.begin(), p.second.end());
		m = p.first;
		int it = 0;
		while (it < (int)p.second.size() && p.second[it].first < m)
			it++;
		while (it < (int)p.second.size() && p.second[it].first == m)
		{
			result[p.second[it].second] = 1;
			it++;
		}

		ll res = 1, nextRes;
		for (ll n = m + 1; it < (int)p.second.size(); n++)
		{
			nextRes = (((fact[n - 1] * invFact[n - m]) % MOD) * invFact[m - 1]) % MOD;
			nextRes = (nextRes * kPow[n - m]) % MOD;
			nextRes = (nextRes + (K + 1LL) * res) % MOD;
			res = nextRes;

			while (it < (int)p.second.size() && p.second[it].first == n)
			{
				result[p.second[it].second] = res;
				it++;
			}
		}
	}

	for (int i = 0; i < req2; i++)
		cout << result[i] << '\n';

	return 0;
}


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

int mod = 1e9 + 7;
const int maxN = 1e5 + 10;
long long fact[maxN];
long long inv[maxN];
long long dp[maxN];
long long p25[maxN];

inline long long add(int a, int b)
{
    return (0LL + a + b) % mod;
}
inline long long mu(int a, int b)
{
    return (1LL * a * b) % mod;
}
long long bpow(int a, int b)
{
    long ans = 1;
    while(b) {
        if(b & 1) {
            ans = mu(ans, a);
        }
        a = mu(a, a);
        b >>= 1;
    }
    return ans;
}
void prep()
{
    fact[0] = 1;
    for(int i=1; i<maxN; i++) {
        fact[i] = mu(fact[i-1], i);
    }
    inv[maxN - 1] = bpow(fact[maxN - 1], mod - 2);
    for(int i=maxN -2; i>=0; i--) {
        inv[i] = mu(inv[i + 1], i + 1);
    }
    p25[0] = 1;
    for(int i=1; i<maxN; i++) {
        p25[i] = mu(p25[i-1], 25);
    }
}
long nCrm(int n, int r)
{
    long ans = 1;
    ans = mu(ans, fact[n]);
    ans = mu(ans, inv[n-r]);
    ans = mu(ans, inv[r]);
    return ans;
}

int main(int argc, char const *argv[])
{
    prep();
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int m;
    string s;
    cin >> m >> s;
    long long len = s.length();
    dp[len] = 1;
    for(int i=len + 1; i < maxN; i++) {
        dp[i] = mu(dp[i-1], 26);
        dp[i] = add(dp[i], mu(nCrm(i-1, len-1), p25[i - len] ));
    }
    int q;
    int n;
    while(m--) {
        cin >> q;
        if(q == 1) {
            cin >> s;
            len = s.length();
            dp[len] = 1;
            for(int i=len + 1; i < maxN; i++) {
                dp[i] = dp[i-1] * 26;
                dp[i] = add(dp[i], mu(nCrm(i-1, len-1), p25[i - len] ));
            }
        }
        if(q == 2) {
            cin >> n;
            cout << dp[n] << endl;
        }
    }
    return 0;
}


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

int mod = 1e9 + 7;
const int maxN = 1e5 + 10;
long long fact[maxN];
long long inv[maxN];
long long dp[maxN];
long long p25[maxN];

inline long long add(int a, int b)
{
    return (0LL + a + b) % mod;
}
inline long long mu(int a, int b)
{
    return (1LL * a * b) % mod;
}
long long bpow(int a, int b)
{
    long ans = 1;
    while(b) {
        if(b & 1) {
            ans = mu(ans, a);
        }
        a = mu(a, a);
        b >>= 1;
    }
    return ans;
}
void prep()
{
    fact[0] = 1;
    for(int i=1; i<maxN; i++) {
        fact[i] = mu(fact[i-1], i);
    }
    inv[maxN - 1] = bpow(fact[maxN - 1], mod - 2);
    for(int i=maxN -2; i>=0; i--) {
        inv[i] = mu(inv[i + 1], i + 1);
    }
    p25[0] = 1;
    for(int i=1; i<maxN; i++) {
        p25[i] = mu(p25[i-1], 25);
    }
}
long nCrm(int n, int r)
{
    long ans = 1;
    ans = mu(ans, fact[n]);
    ans = mu(ans, inv[n-r]);
    ans = mu(ans, inv[r]);
    return ans;
}

int main(int argc, char const *argv[])
{
    prep();
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int m;
    string s;
    cin >> m >> s;
    long long len = s.length();
    dp[len] = 1;
    for(int i=len + 1; i < maxN; i++) {
        dp[i] = mu(dp[i-1], 26);
        dp[i] = add(dp[i], mu(nCrm(i-1, len-1), p25[i - len] ));
    }
    int q;
    int n;
    while(m--) {
        cin >> q;
        if(q == 1) {
            cin >> s;
            len = s.length();
            dp[len] = 1;
            for(int i=len + 1; i < maxN; i++) {
                dp[i] = mu(dp[i-1], 26);
                dp[i] = add(dp[i], mu(nCrm(i-1, len-1), p25[i - len] ));
            }
        }
        if(q == 2) {
            cin >> n;
            if(dp[n] < 0) {
                cout << dp[n] + mod << endl;
            }
            else {
                cout << dp[n] << endl;
            }
        }
    }
    return 0;
}


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

int mod = 1e9 + 7;
const int maxN = 1e5 + 10;
int fact[maxN];
int inv[maxN];
int dp[maxN];
int p25[maxN];

inline int add(int a, int b)
{
    return (0LL + a + b) % mod;
}
inline int mu(int a, int b)
{
    return (1LL * a * b) % mod;
}
int bpow(int a, int b)
{
    int ans = 1;
    while(b) {
        if(b & 1) {
            ans = mu(ans, a);
        }
        a = mu(a, a);
        b >>= 1;
    }
    return ans;
}
void prep()
{
    fact[0] = 1;
    for(int i=1; i<maxN; i++) {
        fact[i] = mu(fact[i-1], i);
    }
    inv[maxN - 1] = bpow(fact[maxN - 1], mod - 2);
    for(int i=maxN -2; i>=0; i--) {
        inv[i] = mu(inv[i + 1], i + 1);
    }
    p25[0] = 1;
    for(int i=1; i<maxN; i++) {
        p25[i] = mu(p25[i-1], 25);
    }
}
int nCrm(int n, int r)
{
    int ans = 1;
    ans = mu(ans, fact[n]);
    ans = mu(ans, inv[n-r]);
    ans = mu(ans, inv[r]);
    return ans;
}

int main(int argc, char const *argv[])
{
    prep();
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int m;
    string s;
    cin >> m >> s;
    int len = s.length();
    dp[len] = 1;
    for(int i=len + 1; i < maxN; i++) {
        dp[i] = dp[i-1] * 26;
        dp[i] = add(dp[i], mu(nCrm(i-1, len-1), p25[i - len] ));
    }
    int q;
    int n;
    while(m--) {
        cin >> q;
        if(q == 1) {
            cin >> s;
            len = s.length();
            dp[len] = 1;
            for(int i=len + 1; i < maxN; i++) {
                dp[i] = dp[i-1] * 26;
                dp[i] = add(dp[i], mu(nCrm(i-1, len-1), p25[i - len] ));
            }
        }
        if(q == 2) {
            cin >> n;
            cout << dp[n] << endl;
        }
    }
    return 0;
}


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

int mod = 1e9 + 7;
const int maxN = 1e5 + 10;
long long fact[maxN];
long long inv[maxN];
long long dp[maxN];
long long p25[maxN];

inline long long add(int a, int b)
{
    return (0LL + a + b) % mod;
}
inline long long mu(int a, int b)
{
    return (1LL * a * b) % mod;
}
long long bpow(int a, int b)
{
    long ans = 1;
    while(b) {
        if(b & 1) {
            ans = mu(ans, a);
        }
        a = mu(a, a);
        b >>= 1;
    }
    return ans;
}
void prep()
{
    fact[0] = 1;
    for(int i=1; i<maxN; i++) {
        fact[i] = mu(fact[i-1], i);
    }
    inv[maxN - 1] = bpow(fact[maxN - 1], mod - 2);
    for(int i=maxN -2; i>=0; i--) {
        inv[i] = mu(inv[i + 1], i + 1);
    }
    p25[0] = 1;
    for(int i=1; i<maxN; i++) {
        p25[i] = mu(p25[i-1], 25);
    }
}
long nCrm(int n, int r)
{
    long ans = 1;
    ans = mu(ans, fact[n]);
    ans = mu(ans, inv[n-r]);
    ans = mu(ans, inv[r]);
    return ans;
}

int main(int argc, char const *argv[])
{
    prep();
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int m;
    string s;
    cin >> m >> s;
    long long len = s.length();
    dp[len] = 1;
    for(int i=len + 1; i < maxN; i++) {
        dp[i] = mu(dp[i-1], 26);
        dp[i] = add(dp[i], mu(nCrm(i-1, len-1), p25[i - len] ));
    }
    int q;
    int n;
    while(m--) {
        cin >> q;
        if(q == 1) {
            cin >> s;
            len = s.length();
            dp[len] = 1;
            for(int i=len + 1; i < maxN; i++) {
                dp[i] = mu(dp[i-1], 26);
                dp[i] = add(dp[i], mu(nCrm(i-1, len-1), p25[i - len] ));
            }
        }
        if(q == 2) {
            cin >> n;
            if(n < len) {
                cout << 0 << endl;
            }
            else if(dp[n] < 0) {
                cout << dp[n] + mod << endl;
            }
            else {
                cout << dp[n] << endl;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 100005, K = 450;
const long long M = 1000000007;

struct ban
{
    int x;
    ban()
    {
        x = 0;
    }
    ban(long long x)
    {
        this->x = (x % M);
    }
};
ban operator+(const ban& a, const ban& b)
{
    return ban(a.x + b.x);
}
ban operator-(const ban& a, const ban& b)
{
    return ban(a.x - b.x + M);
}
ban operator*(const ban& a, const ban& b)
{
    return ban(a.x * 1LL * b.x);
}
ban ast(ban x, long long n)
{
    ban ans(1);
    while (n)
    {
        if (n % 2 == 1)
            ans = ans * x;
        x = x * x;
        n /= 2;
    }
    return ans;
}
ban inv(const ban& x)
{
    return ast(x, M - 2);
}

ban f[N];
ban invf[N];
ban ast25[N];
void pre()
{
    f[0] = ban(1);
    for (int i = 1; i < N; ++i)
        f[i] = f[i - 1] * ban(i);
    for (int i = 0; i < N; ++i)
        invf[i] = inv(f[i]);
    ast25[0] = ban(1);
    for (int i = 1; i < N; ++i)
        ast25[i] = ast25[i - 1] * ban(25);
}

ban C(long long n, long long k)
{
    return f[n] * invf[k] * invf[n - k];
}

int k;
int u[K];
ban ans[K][N];

int n;
int kk;

void ubd()
{
    for (int i = 1; i <= k; ++i)
    {
        if (u[i] == n)
        {
            kk = i;
            return;
        }
    }
    ++k;
    u[k] = n;
    kk = k;
    ans[k][n] = ban(1);
    for (int i = n + 1; i < N; ++i)
        ans[k][i] = ans[k][i - 1] * ban(26) + C(i - 1, n - 1) * ast25[i - n];
}

int m;
char s[N];
int main()
{
    /*int sum = 0;
    for (int i = 1; ; ++i)
    {
        sum += i;
        if (sum > N)
        {
            printf("%d\n", i);
            return 0;
        }
    }*/
    pre();
    scanf("%d", &m);
    scanf(" %s", s);
    n = strlen(s);
    ubd();
    while (m--)
    {
        int ty;
        scanf("%d", &ty);
        if (ty == 1)
        {
            scanf(" %s", s);
            n = strlen(s);
            ubd();
        }
        else
        {
            int x;
            scanf("%d", &x);
            printf("%d\n", ans[kk][x].x);
        }
    }
    return 0;
}


#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define Size(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define ULL(...)                                                                                \
    ull __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LD(...)                                                                                \
    ld __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
template <class T> void scan(T a) { cin >> a; }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(long double &a) { cin >> a; }
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(deque<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
    for(auto &i : a) scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
    scan(p.first);
    scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
string stin() {
    string s;
    cin >> s;
    return s;
}
template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x));
    x.erase(unique(all(x)), x.end());
}
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}
void print() { putchar(' '); }
void print(bool a) { cout << a; }
void print(int a) { cout << a; }
void print(long long a) { cout << a; }
void print(char a) { cout << a; }
void print(string &a) { cout << a; }
void print(double a) { cout << a; }
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
    cout << endl;
}
template <class T> void print(const deque<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, size_t size> void print(const array<T, size> &a) {
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, class L> void print(const pair<T, L> &p) {
    cout << '(';
    print(p.first);
    cout << ",";
    print(p.second);
    cout << ')';
}
template <class T> void print(set<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T> void print(multiset<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T, size_t size> void print(const T (&a)[size]) {
    print(a[0]);
    for(auto i = a; ++i != end(a);) {
        cout << " ";
        print(*i);
    }
}
template <class T> void print(const T &a) { cout << a; }
int out() {
    putchar('\n');
    return 0;
}
template <class T> int out(const T &t) {
    print(t);
    putchar('\n');
    return 0;
}
template <class Head, class... Tail> int out(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
    return 0;
}
ll gcd(ll a, ll b) {
    while(b) {
        ll c = b;
        b = a % b;
        a = c;
    }
    return a;
}
ll lcm(ll a, ll b) {
    if(!a || !b) return 0;
    return a * b / gcd(a, b);
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
vector<int> divisor(int x) {
    vector<int> ans;
    for(int i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <typename T> void zip(vector<T> &x) {
    vector<T> y = x;
    sort(all(y));
    for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
int popcount(ll x) { return __builtin_popcountll(x); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
template <typename T> void shuffle(vector<T> &v) {
    rep3(i, v.size() - 1, 1) { swap(v[i], v[rnd(i)]); }
}
#define endl '\n'
vector<string> YES{"NO", "YES"};
vector<string> Yes{"No", "Yes"};
vector<string> yes{"no", "yes"};

#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    print(x);                                                                                \
    cout << endl;
void err() {}
template <class T> void err(const T &t) {
    print(t);
    cout << " ";
}
template <class Head, class... Tail> void err(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
}
#else
#define debug(x)
template <class... T> void err(const T &...) {}
#endif

template <typename T> struct edge {
    int from, to;
    T cost;
    int id;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;

struct Graph : vector<vector<int>> {
    using vector<vector<int>>::vector;
    inline void add(int a, int b, bool directed = false) {
        (*this)[a].emplace_back(b);
        if(!directed) (*this)[b].emplace_back(a);
    }
    void read(int n = -1, int offset = 1) {
        if(n == -1) n = this->size() - 1;
        int a, b;
        while(n--) {
            cin >> a >> b;
            Graph::add(a - offset, b - offset);
        }
    }
};
template <typename T> struct WeightedGraph : vector<Edges<T>> {
    using vector<Edges<T>>::vector;
    inline void add(int a, int b, T c, bool directed = false) {
        (*this)[a].emplace_back(b, c);
        if(!directed) (*this)[b].emplace_back(a, c);
    }
    void read(int n = -1, int offset = 1) {
        if(n == -1) n = this->size() - 1;
        int a, b;
        T c;
        while(n--) {
            cin >> a >> b >> c;
            WeightedGraph::add(a - offset, b - offset, c);
        }
    }
};
struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
#pragma endregion

// _________コーディングはここから！！___________
namespace modular {
constexpr ll MOD = 1000000007;
const int MAXN = 1100000;
template <ll Modulus> class modint {
    using u64 = ll;

  public:
    u64 a;

    constexpr modint(const u64 x = 0) noexcept : a(((x % Modulus) + Modulus) % Modulus) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr modint operator+(const modint rhs) const noexcept { return modint(*this) += rhs; }
    constexpr modint operator-(const modint rhs) const noexcept { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint rhs) const noexcept { return modint(*this) *= rhs; }
    template <typename T> constexpr modint operator^(T rhs) const noexcept { return modint(*this) ^= rhs; }
    constexpr modint &operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if(a >= Modulus) { a -= Modulus; }
        return *this;
    }
    constexpr modint &operator-=(const modint rhs) noexcept {
        if(a < rhs.a) { a += Modulus; }
        a -= rhs.a;
        return *this;
    }
    constexpr modint &operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr bool operator==(const modint rhs) const noexcept { return a == rhs.a; }
    template <typename T> constexpr modint &operator^=(T n) noexcept {
        modint<Modulus> res = 1;
        modint<Modulus> x = a;
        while(n) {
            if(n & 1) res *= x;
            x *= x;
            n >>= 1;
        }
        a = res.a;
        return *this;
    }
};
#define mint modint<MOD>
#define vmint vector<mint>
vmint Inv{0, 1}, Prd{1, 1}, Invprd{1, 1};
mint inv(int n) {
    if(Inv.size() > n)
        return Inv[n];
    else {
        for(int i = Inv.size(); i <= n; ++i) Inv.emplace_back(Inv[MOD % i] * (-MOD / i));
        return Inv[n];
    }
}
mint prd(int n) {
    if(Prd.size() > n)
        return Prd[n];
    else
        for(int i = Prd.size(); i <= n; ++i) Prd.emplace_back(Prd[i - 1] * i);
    return Prd[n];
}
mint invprd(int n) {
    if(Invprd.size() > n)
        return Invprd[n];
    else
        for(int i = Invprd.size(); i <= n; ++i) Invprd.emplace_back(Invprd[i - 1] * inv(i));
    return Invprd[n];
}
mint modpow(ll a, ll n) {
    mint x = a;
    return x ^= n;
}
template <ll T> modint<T> operator/(modint<T> l, modint<T> r) {
    if(r.a < MAXN) return l * inv(r.a);
    return l * (r ^ (MOD - 2));
}
template <typename T, ll S> modint<S> operator/(T l, modint<S> r) { return modint<S>(l) / r; }
template <ll T> modint<T> operator/=(modint<T> &l, modint<T> r) { return l = l / r; }
mint C(int a, int b) {
    if(a < 0 || b < 0) return 0;
    if(a < b) return 0;
    return prd(a) * invprd(b) * invprd(a - b);
}
mint P(int a, int b) {
    if(a < 0 || b < 0) return 0;
    if(a < b) return 0;
    return prd(a) * invprd(a - b);
}
ostream &operator<<(ostream &os, mint a) {
    os << a.a;
    return os;
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &a) {
    for(auto &e : a) os << e << " ";
    os << endl;
    return os;
}
istream &operator>>(istream &is, mint &a) {
    ll x;
    is >> x;
    a = x;
    return is;
}
} // namespace modular
using namespace modular;
main() {
    INT(T);
    STR(s);
    map<pii, int> mp;
    while(T--) {
        INT(t);
        if(t == 1) {
            cin >> s;
        } else {
            INT(n);
            if(n < s.size()) {
                cout << 0 << endl;
                continue;
            }
            if(!mp.count(pii(s.size(), n))) {
                mint ans = modpow(26, n);
                rep(i, s.size()) { ans -= modpow(25, n - i) * C(n, i); }
                mp[pii(s.size(), n)] = ans.a;
            }
            cout << mp[pii(s.size(), n)] << endl;
        }
    }
}


#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define Size(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define ULL(...)                                                                                \
    ull __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LD(...)                                                                                \
    ld __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
template <class T> void scan(T a) { cin >> a; }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(long double &a) { cin >> a; }
void scan(char a[]) { scanf("%s", a); }
void scan(string &a) { cin >> a; }
template <class T> void scan(vector<T> &);
template <class T, size_t size> void scan(array<T, size> &);
template <class T, class L> void scan(pair<T, L> &);
template <class T, size_t size> void scan(T (&)[size]);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(deque<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T, size_t size> void scan(array<T, size> &a) {
    for(auto &i : a) scan(i);
}
template <class T, class L> void scan(pair<T, L> &p) {
    scan(p.first);
    scan(p.second);
}
template <class T, size_t size> void scan(T (&a)[size]) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
string stin() {
    string s;
    cin >> s;
    return s;
}
template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x));
    x.erase(unique(all(x)), x.end());
}
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}
void print() { putchar(' '); }
void print(bool a) { cout << a; }
void print(int a) { cout << a; }
void print(long long a) { cout << a; }
void print(char a) { cout << a; }
void print(string &a) { cout << a; }
void print(double a) { cout << a; }
template <class T> void print(const vector<T> &);
template <class T, size_t size> void print(const array<T, size> &);
template <class T, class L> void print(const pair<T, L> &p);
template <class T, size_t size> void print(const T (&)[size]);
template <class T> void print(const vector<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
    cout << endl;
}
template <class T> void print(const deque<T> &a) {
    if(a.empty()) return;
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, size_t size> void print(const array<T, size> &a) {
    print(a[0]);
    for(auto i = a.begin(); ++i != a.end();) {
        cout << " ";
        print(*i);
    }
}
template <class T, class L> void print(const pair<T, L> &p) {
    cout << '(';
    print(p.first);
    cout << ",";
    print(p.second);
    cout << ')';
}
template <class T> void print(set<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T> void print(multiset<T> &x) {
    for(auto e : x) print(e), cout << " ";
    cout << endl;
}
template <class T, size_t size> void print(const T (&a)[size]) {
    print(a[0]);
    for(auto i = a; ++i != end(a);) {
        cout << " ";
        print(*i);
    }
}
template <class T> void print(const T &a) { cout << a; }
int out() {
    putchar('\n');
    return 0;
}
template <class T> int out(const T &t) {
    print(t);
    putchar('\n');
    return 0;
}
template <class Head, class... Tail> int out(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
    return 0;
}
ll gcd(ll a, ll b) {
    while(b) {
        ll c = b;
        b = a % b;
        a = c;
    }
    return a;
}
ll lcm(ll a, ll b) {
    if(!a || !b) return 0;
    return a * b / gcd(a, b);
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
vector<int> divisor(int x) {
    vector<int> ans;
    for(int i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <typename T> void zip(vector<T> &x) {
    vector<T> y = x;
    sort(all(y));
    for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
int popcount(ll x) { return __builtin_popcountll(x); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
template <typename T> void shuffle(vector<T> &v) {
    rep3(i, v.size() - 1, 1) { swap(v[i], v[rnd(i)]); }
}
#define endl '\n'
vector<string> YES{"NO", "YES"};
vector<string> Yes{"No", "Yes"};
vector<string> yes{"no", "yes"};

#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    print(x);                                                                                \
    cout << endl;
void err() {}
template <class T> void err(const T &t) {
    print(t);
    cout << " ";
}
template <class Head, class... Tail> void err(const Head &head, const Tail &... tail) {
    print(head);
    putchar(' ');
    out(tail...);
}
#else
#define debug(x)
template <class... T> void err(const T &...) {}
#endif

template <typename T> struct edge {
    int from, to;
    T cost;
    int id;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;

struct Graph : vector<vector<int>> {
    using vector<vector<int>>::vector;
    inline void add(int a, int b, bool directed = false) {
        (*this)[a].emplace_back(b);
        if(!directed) (*this)[b].emplace_back(a);
    }
    void read(int n = -1, int offset = 1) {
        if(n == -1) n = this->size() - 1;
        int a, b;
        while(n--) {
            cin >> a >> b;
            Graph::add(a - offset, b - offset);
        }
    }
};
template <typename T> struct WeightedGraph : vector<Edges<T>> {
    using vector<Edges<T>>::vector;
    inline void add(int a, int b, T c, bool directed = false) {
        (*this)[a].emplace_back(b, c);
        if(!directed) (*this)[b].emplace_back(a, c);
    }
    void read(int n = -1, int offset = 1) {
        if(n == -1) n = this->size() - 1;
        int a, b;
        T c;
        while(n--) {
            cin >> a >> b >> c;
            WeightedGraph::add(a - offset, b - offset, c);
        }
    }
};
struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
#pragma endregion

// _________コーディングはここから！！___________
namespace modular {
constexpr ll MOD = 1000000007;
const int MAXN = 1100000;
template <ll Modulus> class modint {
    using u64 = ll;

  public:
    u64 a;

    constexpr modint(const u64 x = 0) noexcept : a(((x % Modulus) + Modulus) % Modulus) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr modint operator+(const modint rhs) const noexcept { return modint(*this) += rhs; }
    constexpr modint operator-(const modint rhs) const noexcept { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint rhs) const noexcept { return modint(*this) *= rhs; }
    template <typename T> constexpr modint operator^(T rhs) const noexcept { return modint(*this) ^= rhs; }
    constexpr modint &operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if(a >= Modulus) { a -= Modulus; }
        return *this;
    }
    constexpr modint &operator-=(const modint rhs) noexcept {
        if(a < rhs.a) { a += Modulus; }
        a -= rhs.a;
        return *this;
    }
    constexpr modint &operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr bool operator==(const modint rhs) const noexcept { return a == rhs.a; }
    template <typename T> constexpr modint &operator^=(T n) noexcept {
        modint<Modulus> res = 1;
        modint<Modulus> x = a;
        while(n) {
            if(n & 1) res *= x;
            x *= x;
            n >>= 1;
        }
        a = res.a;
        return *this;
    }
};
#define mint modint<MOD>
#define vmint vector<mint>
vmint Inv{0, 1}, Prd{1, 1}, Invprd{1, 1};
mint inv(int n) {
    if(Inv.size() > n)
        return Inv[n];
    else {
        for(int i = Inv.size(); i <= n; ++i) Inv.emplace_back(Inv[MOD % i] * (-MOD / i));
        return Inv[n];
    }
}
mint prd(int n) {
    if(Prd.size() > n)
        return Prd[n];
    else
        for(int i = Prd.size(); i <= n; ++i) Prd.emplace_back(Prd[i - 1] * i);
    return Prd[n];
}
mint invprd(int n) {
    if(Invprd.size() > n)
        return Invprd[n];
    else
        for(int i = Invprd.size(); i <= n; ++i) Invprd.emplace_back(Invprd[i - 1] * inv(i));
    return Invprd[n];
}
mint modpow(ll a, ll n) {
    mint x = a;
    return x ^= n;
}
template <ll T> modint<T> operator/(modint<T> l, modint<T> r) {
    if(r.a < MAXN) return l * inv(r.a);
    return l * (r ^ (MOD - 2));
}
template <typename T, ll S> modint<S> operator/(T l, modint<S> r) { return modint<S>(l) / r; }
template <ll T> modint<T> operator/=(modint<T> &l, modint<T> r) { return l = l / r; }
mint C(int a, int b) {
    if(a < 0 || b < 0) return 0;
    if(a < b) return 0;
    return prd(a) * invprd(b) * invprd(a - b);
}
mint P(int a, int b) {
    if(a < 0 || b < 0) return 0;
    if(a < b) return 0;
    return prd(a) * invprd(a - b);
}
ostream &operator<<(ostream &os, mint a) {
    os << a.a;
    return os;
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &a) {
    for(auto &e : a) os << e << " ";
    os << endl;
    return os;
}
istream &operator>>(istream &is, mint &a) {
    ll x;
    is >> x;
    a = x;
    return is;
}
} // namespace modular
using namespace modular;
main() {
    INT(T);
    STR(s);
    while(T--) {
        INT(t);
        if(t == 1) {
            cin >> s;
        } else {
            INT(n);
            if(n < s.size()) {
                cout << 0 << endl;
                continue;
            }
            mint ans = modpow(26, n);
            rep(i, s.size()) { ans -= modpow(25, n - i) * C(n, i); }
            cout << ans << endl;
        }
    }
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (int) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2
#define v(x) (int)(x - 'a')

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const int inf = numeric_limits <int>::max() >> 1;
const int mod = 1e9 + 7;
const int N = 1e5 + 1;
int q, curlen;
int ans[N];
int fac[N];
int inv[N];
int tmp[N];

struct Query {
    int k, n, i;
};

vec <Query> queries;

inline int fpow(int b, int p = mod - 2) {
    ll res = 1;
    ll pow = b;
    for(; p; p >>= 1) {
        if(p & 1) {
            res *= pow;
            res %= mod;
        }
        pow *= pow;
        pow %= mod;
    }
    return res;
}

inline int bin(int a, int b) {
    return 1ll * fac[a] * inv[b] % mod * inv[a - b] % mod;
}

void input() {
    cin >> q;
    string txt; cin >> txt;
    curlen = len(txt);
    for(int i = 1; i <= q; ++i) {
        int t; cin >> t;
        if(t == 1) {
            string txt; cin >> txt;
            curlen = len(txt);
        } else {
            int k; cin >> k;
            queries.pb({curlen, k, i});
        }
    }
    sort(all(queries), [](Query x, Query y) {
        return x.k < y.k;
    });
}

void calc_fac() {
    fac[0] = 1;
    inv[0] = 1;
    for(int i = 1; i < N; ++i) {
        fac[i] = 1ll * fac[i - 1] * i % mod;
        inv[i] = fpow(fac[i]);
    }
}

void recalc(int k) {
    tmp[k] = 1;
    for(int i = k + 1; i < N; ++i) {
        tmp[i] = (26ll * tmp[i - 1] + 1ll * fpow(25, i - k) * bin(i - 1, k - 1)) % mod;
    }
}

void solve() {
    calc_fac();
    int curlen = -1;
    for(int i = 0; i < len(queries); ++i) {
        if(curlen != queries[i].k) {
            curlen = queries[i].k;
            recalc(curlen);
        }
        ans[queries[i].i] = tmp[queries[i].n];
    }
    for(int i = 1; i <= q; ++i) {
        if(ans[i]) {
            cout << ans[i] << "\n";
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}