#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
const int N = 1005, KK = 25;
int Ways[N][N], dp[KK][KK], dp2[KK][KK], fdp[KK][KK];
vector<pair<int, int>> trp, prms;
signed main(){
int n, m, k, T, Z, id = 0;
cin>>n>>m>>k>>T>>Z;
trp = {{0, 0}, {n, m}};
for (int i=1, x, y;i<=k;i++){
cin>>x>>y;
trp.push_back({x, y});
}
sort(begin(trp), end(trp));
Ways[0][0] = 1;
for (int i=0;i<N;i++){
for (int j=0;j<N;j++){
if (i)
Ways[i][j] = (Ways[i][j] + Ways[i-1][j]) % Z;
if (j)
Ways[i][j] = (Ways[i][j] + Ways[i][j-1]) % Z;
// if (max(i, j) < 10)
// cout<<Ways[i][j]<<' ';
}
// if (i < 10)
// cout<<'\n';
}
for (int i=0;i<k+2;i++){
for (int j=0;j<k+2;j++){
int X = trp[j].first - trp[i].first, Y = trp[j].second - trp[i].second, A, M = 0, a, m;
if (X < 0 or Y < 0)
continue;
dp[i][j] = Ways[X][Y];
}
}
for (int i=0;i<k+2;i++){
for (int j=0;j<k+2;j++){
if (!dp[i][j])
continue;
dp2[i][j] = dp[i][j];
for (int l=i+1;l<j;l++)
dp2[i][j] = (dp2[i][j] - dp2[i][l] * dp[l][j]) % Z;
// cout<<i<<" "<<j<<" "<<dp[i][j]<<" "<<dp2[i][j]<<'\n';
}
}
fdp[0][0] = 1;
for (int i=1;i<k+2;i++){
for (int j=0;j<i;j++)
for (int t=0;t<=T;t++)
fdp[i][t+1] = (fdp[i][t+1] + fdp[j][t] * dp2[j][i]) % Z;
}
int Ans = 0;
for (int t=0;t<=T+1;t++)
Ans = (Ans + fdp[k+1][t]) % Z;
cout<<Ans<<'\n';
}