#include #include int cmp (const void *a, const void *b) { int *a_ = (int *)a; int *b_ = (int *)b; if (a_[0] > b_[0]) { return 1; } if (a_[0] < b_[0]) { return -1; } if (a_[1] > b_[1]) { return 1; } if (a_[1] < b_[1]) { return -1; } return 0; } long long power_mod (long long a, long long b, long long mod_num) { long long ans = 1LL; if (b > 0LL) { ans = power_mod(a, b/2LL, mod_num); ans = (ans * ans) % mod_num; if (b%2LL == 1LL) { ans = (ans * (a % mod_num)) % mod_num; } } return ans; } void set_segt (int *t, int idx, int val, int size) { idx = idx+size-1; t[idx] = val; while (idx > 0) { idx = (idx-1)/2; t[idx] = t[2*idx+1]; if (t[2*idx+2] > t[idx]) { t[idx] = t[2*idx+2]; } } return; } int max_segt_rec (int *t, int a, int b, int k, int l, int r) { int ans = 0; int tmp = 0; if (r <= a || b <= l) { return 0; } if (a <= l && r <= b) { return t[k]; } ans = max_segt_rec(t, a, b, 2*k+1, l, (l+r)/2); tmp = max_segt_rec(t, a, b, 2*k+2, (l+r)/2, r); if (tmp > ans) { ans = tmp; } return ans; } int max_segt (int *t, int a, int b, int size) { return max_segt_rec(t, a, b, 0, 0, size); } int main () { int h = 0; int w = 0; int n = 0; long long p = 0LL; int xy[200000][2] = {}; int res = 0; long long ans = 0LL; long long mod_num = 998244353LL; int max = 0; int t[600000] = {}; int size = 1; res = scanf("%d", &h); res = scanf("%d", &w); res = scanf("%d", &n); res = scanf("%lld", &p); for (int i = 0; i < n; i++) { res = scanf("%d", xy[i]); res = scanf("%d", xy[i]+1); } qsort(xy, n, sizeof(int)*2, cmp); while (size <= w) { size <<= 1; } for (int i = 0; i < n; i++) { int tmp = max_segt(t, 0, xy[i][1]+1, size); set_segt(t, xy[i][1], tmp+1, size); } max = max_segt(t, 0, w+1, size); ans = power_mod(p-2LL, (long long)max, mod_num); ans *= power_mod(p-1LL, (long long)(h+w-3-max), mod_num); ans %= mod_num; ans *= power_mod(p, ((long long)(h+w-3))*(mod_num-2LL), mod_num); ans %= mod_num; ans = 1LL+mod_num-ans; ans %= mod_num; printf("%lld\n", ans); return 0; }