#include<bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9+7; const int maxn = 23; const int maxv = 10007; int v[maxn],c[maxn]; int dp[maxv];
int main(){ int t,n,q,s; //cin>>t; scanf("%d",&t); while(t--){ //cin>>n>>q; scanf("%d %d",&n,&q); for(int i=1;i<=n;++i){ //cin>>v[i]>>c[i]; scanf("%d%d",&v[i],&c[i]); } memset(dp,0,sizeof(dp));