#include #define ALL(x) (x).begin(), (x).end() #define LB(v, x) (int)(lower_bound(ALL(v), x) - v.begin()) #define UQ(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end()) #define IO ios::sync_with_stdio(false), cin.tie(nullptr); #define chmax(a, b) (a) = (a) < (b) ? (b) : (a) #define chmin(a, b) (a) = (a) < (b) ? (a) : (b) using namespace std; using ll = long long; const int INF = 1e9 + 10; const ll INFL = 4e18; template struct ModInt { ll value; ModInt(ll x = 0) { value = (x >= 0 ? x % MOD : MOD - (-x) % MOD); } ModInt operator-() const { return ModInt(-value); } ModInt operator+() const { return ModInt(*this); } ModInt& operator+=(const ModInt& other) { value += other.value; if (value >= MOD) value -= MOD; return *this; } ModInt& operator-=(const ModInt& other) { value += MOD - other.value; if (value >= MOD) value -= MOD; return *this; } ModInt& operator*=(const ModInt other) { value = value * other.value % MOD; return *this; } ModInt& operator/=(ModInt other) { (*this) *= other.inv(); return *this; } ModInt operator+(const ModInt& other) const { return ModInt(*this) += other; } ModInt operator-(const ModInt& other) const { return ModInt(*this) -= other; } ModInt operator*(const ModInt& other) const { return ModInt(*this) *= other; } ModInt operator/(const ModInt& other) const { return ModInt(*this) /= other; } ModInt pow(ll x) const { ModInt ret(1), mul(value); while (x) { if (x & 1) ret *= mul; mul *= mul; x >>= 1; } return ret; } ModInt inv() const { return pow(MOD - 2); } bool operator==(const ModInt& other) const { return value == other.value; } bool operator!=(const ModInt& other) const { return value != other.value; } friend ostream& operator<<(ostream& os, const ModInt& x) { return os << x.value; } friend istream& operator>>(istream& is, ModInt& x) { ll v; is >> v; x = ModInt(v); return is; } static constexpr ll get_mod() { return MOD; } }; using Mod998 = ModInt<998244353>; using Mod107 = ModInt<1000000007>; using mint = Mod998; int main() { int N, M; string S; cin >> N >> M >> S; vector> G(N); for (int i = 0; i < M; i++) { int u, v; cin >> u >> v; u--, v--; G[u].push_back(v), G[v].push_back(u); } vector po(N + 1); po[0] = 1; for (int i = 1; i <= N; i++) po[i] = po[i - 1] * 26; int q = count(ALL(S), '?'); mint ans = 0; for (int i = 0; i < N; i++) { if (S[i] == 'o' || S[i] == '?') { int d = ssize(G[i]); for (int j = 0; j < d; j++) { int a = G[i][j]; if (S[a] == 'a' || S[a] == '?') { for (int k = 0; k < d; k++) { int b = G[i][k]; if (S[b] == 'i' || (S[b] == '?' && a != b)) { int r = (S[a] == '?') + (S[i] == '?') + (S[b] == '?'); ans += po[q - r]; } } } } } } cout << ans << endl; }