const int P = ;
auto modv = [](int x) {
if(x < 0) x += P;
if(x >= P) x -= P;
return x;
};
template <class T>
T qp(T a, int b = P - 2) {
T z = 1;
for (; b; b >>= 1, a *= a)
if (b & 1) z *= a;
return z;
};
#include <cassert>
struct Z{
int x;
Z() : x() {}
Z(int x) : x(modv(x)) {}
int val()const {return x;}
Z operator-()const {
return Z(modv(-x));
}
Z inv() const {
assert(x);
return qp(*this);
};
Z& operator+=(const Z& _) {
x = modv(x + _.x);
return *this;
}
Z& operator-=(const Z& _) {
x = modv(x - _.x);
return *this;
}
Z& operator*=(const Z& _) {
x = 1ll * x *_.x % P;
return *this;
}
Z& operator/=(const Z& _){
return *this *= _.inv();
}
Z operator+(const Z& _) const {
return Z(modv(x + _.x));
}
Z operator-(const Z& _) const {
return Z(modv(x - _.x));
}
Z operator*(const Z& _) const {
return Z(1ll * x *_.x % P);
}
Z operator/(const Z& _) const {
return *this * _.inv();
}
};
#include <iostream>
std::ostream& operator <<(std::ostream& out, const Z& x) {
return out << x.x, out;
}
std::istream& operator >>(std::istream& in, Z& x) {
return in >> x.x, in;
}