#include <bits/stdc++.h>
using namespace std;
long long int mypow(long long int a, long long int n) {
  long long int ans = 1, now = a;
  while (n) {
    if (n & 1) {
      ans *= now;
      ans %= (1000000007);
    }
    now *= now;
    now %= (1000000007);
    n >>= 1;
  }
  return ans;
}
int p[400][400];
long long int pow25[100010];
struct Reverse {
  long long int reverse(long long int a) { return mypow(a, (1000000007) - 2); }
} r1;
struct Cn {
  long long int p[100010];
  long long int revp[100010];
  long long int ans[100010];
  int n;
  void init(int nn, Reverse* r) {
    n = nn;
    int i;
    p[0] = revp[0] = 1;
    for (i = 1; i <= n; i++) {
      p[i] = (p[i - 1] * i) % (1000000007);
      revp[i] = r->reverse(p[i]);
    }
    for (i = 0; i <= n; i++) {
      ans[i] = CC(i);
    }
  }
  long long int CC(int a) {
    long long int ans = p[n];
    ans *= revp[a];
    ans %= (1000000007);
    ans *= revp[n - a];
    ans %= (1000000007);
    return ans;
  }
  long long int Cij(int i, int j) {
    if (i > j) return 0;
    long long int ans = p[j];
    ans *= revp[i];
    ans %= (1000000007);
    ans *= revp[j - i];
    ans %= (1000000007);
    return ans;
  }
  long long int C(int a) { return ans[a]; }
} cn;
char s[100010];
int i, j, n, m;
long long int F(int i, int j) {
  if (i < 0 || j < 0) return 0;
  if (i == j) return 1;
  if (j < n) {
    return mypow(25, i - j) * cn.Cij(j, i) % 1000000007;
  } else {
    return (F(i - 1, j - 1) + 26 * F(i - 1, j)) % (1000000007);
  }
}
int Q(int i, int j) {
  long long int ans = (long long int)pow25[i - j] * cn.Cij(j, i) % (1000000007);
  return (int)ans;
}
void prepare() {
  p[0][0] = 1;
  for (i = 1, j = 300; j < 100010; i++, j += 300) {
    p[i][0] = mypow(26, j);
  }
  for (i = 1; i * 300 < 100010; i++) {
    for (j = 1; j <= i; j++) {
      int last = (j - 1) * 300;
      int now = p[i][j - 1], lastnow = 0;
      for (int k = 0; k < 300; k++) {
        n = last + 1;
        lastnow = now;
        now = (lastnow - Q(i * 300, last) + (1000000007));
        if (now >= (1000000007)) now -= (1000000007);
        last++;
      }
      p[i][j] = now;
    }
  }
}
int FF(int i, int j) {
  if (i < j) return 0;
  if (i % 300 == 0 && j % 300 == 0) {
    return p[i / 300][j / 300];
  }
  if (j % 300) {
    int temp = FF(i, j - 1);
    temp = temp - Q(i, j - 1) + (1000000007);
    if (temp >= (1000000007)) temp -= (1000000007);
    return temp;
  } else {
    long long int temp = FF(i - 1, j);
    temp *= 26;
    if (j && i) temp += Q(i - 1, j - 1);
    return temp % (1000000007);
  }
}
int main() {
  cn.init(100010 - 1, &r1);
  int nn;
  scanf("%d", &nn);
  scanf("%s", s);
  int a;
  pow25[0] = 1;
  for (i = 1; i < 100010; i++) {
    pow25[i] = pow25[i - 1] * 25 % (1000000007);
  }
  prepare();
  n = strlen(s);
  while (nn--) {
    scanf("%d", &a);
    if (a == 1) {
      scanf("%s", s);
      n = strlen(s);
    } else {
      scanf("%d", &m);
      if (m < n) {
        printf("%d\n", 0);
        continue;
      }
      if (m == n) {
        printf("%d\n", 1);
        continue;
      }
      printf("%d\n", (int)FF(m, n));
    }
  }
  return 0;
}
