#include #include using namespace std; using namespace atcoder; using ll=long long; ll inf=1000000000000000001; int main() { int n,k; ll p; cin>>n>>p>>k; vector t(n); vector b(n); for(int i=0;i>t[i]>>b[i]; vector> dp(n+1,vector(k+1)); dp[0][0]=p; for(int i=0;i