#include <bits/stdc++.h>
const int N = 1e5 + 100;
const int mod = 1e9 + 7;
int n, m;
int c;
int fact[N], invFact[N];
std::vector<int> answer[N];
int inverse(int x) {
  if (x == 1) {
    return 1;
  } else {
    return (long long)(mod - mod / x) * inverse(mod % x) % mod;
  }
}
int quickPower(int x, int y) {
  int result = 1;
  for (; y; y >>= 1) {
    if (y & 1) {
      result = (long long)result * x % mod;
    }
    x = (long long)x * x % mod;
  }
  return result;
}
void work() {
  fact[0] = 1;
  invFact[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = (long long)fact[i - 1] * i % mod;
    invFact[i] = inverse(fact[i]);
  }
  std::cin >> m;
  for (int tt = 1; tt <= m + 1; tt++) {
    int type, l;
    if (tt == 1) {
      type = 1;
      std::string str;
      std::cin >> str;
      c = (int)str.length();
    } else {
      scanf("%d", &type);
      if (type == 1) {
        std::string str;
        std::cin >> str;
        c = (int)str.length();
      } else {
        scanf("%d", &l);
      }
    }
    if (type == 1 && answer[c].empty()) {
      int t = 25LL * inverse(26) % mod;
      for (int i = c, tmp = quickPower(t, c); i <= 100000; i++) {
        answer[c].push_back((long long)tmp * fact[i - 1] % mod *
                            invFact[c - 1] % mod * invFact[i - c] % mod);
        tmp = (long long)tmp * t % mod;
      }
      for (int i = 1; i < (int)answer[c].size(); i++) {
        answer[c][i] += answer[c][i - 1];
        answer[c][i] %= mod;
      }
    }
    if (type == 2) {
      if (l < c) {
        printf("0\n");
        continue;
      } else {
        printf("%d\n", (long long)answer[c][l - c] * quickPower(26, l) % mod *
                           inverse(quickPower(25, c)) % mod);
      }
    }
  }
}
int main() {
  work();
  return 0;
}
