#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int test = 0;
int T,n,P,Q,a[31];
cin>>T;
while(T--)
{
test++;
cin>>n>>P>>Q;
for(int i = 0; i<n; ++i)
{
cin>>a[i];
}
int ans = 0;
for(int i = 0,q = 0; i<n; i++)
{
if(ans+1<=P && q+a[i]<=Q)
{
ans++;
q += a[i];
}
else
break;
}
cout<<"Case "<<test<<": "<<ans<<endl;
}
return 0;
}
Add your comment