#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>T; while(T--){ Int n1,n2,m; cin>>n1>>n2>>m; vector a(m); for(Int i=0;i>a[i]; using BS = bitset<114514>; sort(a.begin(),a.end()); BS dp(0); dp[0]=1; Int ans=0; for(Int i=0,s=0;i