#include <iostream> #include <algorithm> #include <cstring> using namespace std; int dp[110][110]; int n,m,k,s; int w[110]; int val[110]; int main () { ios::sync_with_stdio(false); while (cin>>n>>m>>k>>s) { for (int i=1;i<=k;i++) cin>>val[i]>>w[i]; memset (dp,0,sizeof(dp)); for (int i=1;i<=k;i++) for (int j=w[i];j<=m;j++) for (int t=1;t<=s;t++) dp[j][t]=max (dp[j][t],dp[j-w[i]][t-1]+val[i]); int i; for (i=1;i<=m;i++) if (dp[i][s]>=n) break; if (i>m) cout<<"-1 "; else cout<<m-i<<" "; } return 0; }