#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ALL(g) (g).begin(),(g).end() #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define F(i,j,k) fill(i[0],i[0]+j*j,k) #define P(p) cout<<(p)< vi; typedef vector vl; typedef vector vd; typedef pair pii; typedef pair pll; typedef long long ll; int t[101],k[101]; int n,d,ans; void dfs(int day,int nx_place,int yen){ // cout<>n>>d; rep(i,n){ cin>>t[i]>>k[i]; } dfs(0,0,0); dfs(0,1,-d); cout<