This documentation is automatically generated by online-judge-tools/verification-helper
template <i64 mod = MOD>
struct ModInt{
i64 p;
ModInt() : p(0){}
ModInt(i64 x){p = x >= 0 ? x % mod : x + (-x + mod - 1) / mod * mod;}
ModInt& operator+=(const ModInt& y){p = p + *y - ((p + *y) >= mod ? mod : 0); return *this;}
ModInt& operator-=(const ModInt& y){p = p - *y + (p - *y < 0 ? mod : 0); return *this;}
ModInt& operator*=(const ModInt& y){p = (p * *y) % mod; return *this;}
ModInt& operator%=(const ModInt& y){if(y)p %= *y; return *this;}
ModInt operator+(const ModInt& y) const{ModInt x = *this; return x += y;}
ModInt operator-(const ModInt& y) const{ModInt x = *this; return x -= y;}
ModInt operator*(const ModInt& y) const{ModInt x = *this; return x *= y;}
ModInt operator%(const ModInt& y) const{ModInt x = *this; return x %= y;}
friend ostream& operator<<(ostream& stream, const ModInt<mod>& x){
stream << *x;
return stream;
}
friend ostream& operator>>(ostream& stream, const ModInt<mod>& x){
stream >> *x;
return stream;
}
ModInt& operator++(){p = (p + 1) % mod; return *this;}
ModInt& operator--(){p = (p - 1 + mod) % mod; return *this;}
bool operator==(const ModInt& y) const{return p == *y;}
bool operator!=(const ModInt& y) const{return p != *y;}
const i64& operator*() const{return p;}
i64& operator*(){return p;}
};
using mint = ModInt<>;
#line 1 "lib/classes/modint.cpp"
template <i64 mod = MOD>
struct ModInt{
i64 p;
ModInt() : p(0){}
ModInt(i64 x){p = x >= 0 ? x % mod : x + (-x + mod - 1) / mod * mod;}
ModInt& operator+=(const ModInt& y){p = p + *y - ((p + *y) >= mod ? mod : 0); return *this;}
ModInt& operator-=(const ModInt& y){p = p - *y + (p - *y < 0 ? mod : 0); return *this;}
ModInt& operator*=(const ModInt& y){p = (p * *y) % mod; return *this;}
ModInt& operator%=(const ModInt& y){if(y)p %= *y; return *this;}
ModInt operator+(const ModInt& y) const{ModInt x = *this; return x += y;}
ModInt operator-(const ModInt& y) const{ModInt x = *this; return x -= y;}
ModInt operator*(const ModInt& y) const{ModInt x = *this; return x *= y;}
ModInt operator%(const ModInt& y) const{ModInt x = *this; return x %= y;}
friend ostream& operator<<(ostream& stream, const ModInt<mod>& x){
stream << *x;
return stream;
}
friend ostream& operator>>(ostream& stream, const ModInt<mod>& x){
stream >> *x;
return stream;
}
ModInt& operator++(){p = (p + 1) % mod; return *this;}
ModInt& operator--(){p = (p - 1 + mod) % mod; return *this;}
bool operator==(const ModInt& y) const{return p == *y;}
bool operator!=(const ModInt& y) const{return p != *y;}
const i64& operator*() const{return p;}
i64& operator*(){return p;}
};
using mint = ModInt<>;