#include #include #include #include using namespace std; using namespace atcoder; typedef long long ll; ll my_pow(ll x, ll n, ll mod){ ll ret; if (n == 0){ ret = 1; } else if (n % 2 == 1){ ret = (x * my_pow((x * x) % mod, n / 2, mod)) % mod; } else{ ret = my_pow((x * x) % mod, n / 2, mod); } return ret; } ll inv(ll x, ll mod){ return my_pow(x, mod - 2, mod); } ll op(ll a, ll b){ return max(a, b); } ll e(){ return -1e9; } ll mod2 = 998244353; int main(){ ll H,W,N,P; cin >> H >> W >> N >> P; vector x(N); vector y(N); for (ll i = 0; i < N; i++){ cin >> x[i] >> y[i]; } vector> p(N); for (ll i = 0; i < N; i++){ p[i].first = x[i]; p[i].second = y[i]; } sort(p.begin(), p.end()); map mp; mp[1]++; for (ll i = 0; i < N; i++){ mp[y[i]]++; } ll now = 1; for (auto itr = mp.begin(); itr != mp.end(); itr++){ itr->second = now; now++; } segtree seg(now); seg.set(mp[1], 0); for (ll i = 0; i < N; i++){ ll prd = seg.prod(0, mp[p[i].second]); ll val = seg.get(mp[p[i].second]); seg.set(mp[p[i].second], max(val, prd) + 1); } ll max_omen = seg.prod(0, now); //cout << max_omen << endl; ll ans = (my_pow(P, H + W - 3, mod2)); ans = (ans - ((my_pow(P - 1, H + W - 3 - max_omen, mod2)) * (my_pow(P - 2, max_omen, mod2))) % mod2 + mod2) % mod2; ans = (ans * inv((my_pow(P, H + W - 3, mod2)), mod2)) % mod2; cout << ans << endl; }