#include using namespace std; #include using namespace atcoder; using mint = modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; unordered_set s; auto cnt = [&](long long x) -> long long { long long re = 0; vector> v = { {1, 5, 7, 11}, {1, 11, 19, 29}, }; for (auto& i : v) { for (auto& j : i) if (x%j == 0) { long long y = x / j; bool flag = true; for (auto& k : i) if (!s.count(y*k)) flag = false; if (flag) re++; } } return re; }; mint ans = 0; for (int i=0; i> x; s.insert(x); ans += cnt(x); } while (q--) { int t; long long x; cin >> t >> x; if (t == 1) { s.insert(x); ans += cnt(x); } else { ans -= cnt(x); s.erase(x); } cout << ans.val() << '\n'; } }