#include using namespace std; class rolling_hash{ mt19937 mt; const size_t p_cnt = 1; const uint32_t p[3] = {2111511013, 2131131137, 2147483647}; uint64_t b[3]; uint64_t mpow(uint64_t x, uint64_t y, uint32_t m){ if(y == 0) return 1; if(y == 1) return x%m; if(y%2 == 0) return mpow(x*x%m, y/2, m); return mpow(x*x%m, y/2, m) * x % m; } public: rolling_hash(){ random_device rd; mt.seed(rd()); for(size_t i=0;i operator()(string s){ vector h = {0, 0, 0}; for(char c : s){ for(size_t i=0;i yl) return 0; uint64_t bl[p_cnt]; for(size_t i=0;i xh(3, 0), yh(3, 0); for(size_t i=0;i> s; cin >> m; for(int i=0;i> c[i]; uint64_t ans = 0; for(int i=0;i