#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
ll a[maxn];
ll g, p;
ll n;
bool judge(ll k)
{
ll ans;
ll tmp1 = k;
for(ll i = 0; i < min(p, n); ++i){
tmp1 += a[i];
if(tmp1 < 0) tmp1 = 0;
if(tmp1 >= g) return true;
}
if(p <= n) return false;
ll tmp2 = tmp1;
for(ll i = 0; i < min(p - n, n); ++i){
tmp2 += a[i];
if(tmp2 < 0) return false;
if(tmp2 >= g) return true;
}
if(p - n <= n) return false;
if(tmp1 >= tmp2) return false;
ans = tmp2;
ll add = tmp2 - tmp1;
if(p >= 3 * n){
if((g - ans) / add < (p / n - 3)) return true;
ans += add * (p / n - 3);
if(ans >= g) return true;
for(ll i = 0; i < n; ++i){
ans += a[i];
if(ans >= g) return true;
}
}
for(ll i = 0; i < p - p / n * n; ++i){
ans += a[i];
if(ans >= g) return true;
}
return false;
}
int main (void)
{
int T;scanf("%d", &T);
for(int tt = 1; tt <= T; ++tt){
scanf("%lld%lld%lld", &n, &g, &p);
for(ll i = 0; i < n; ++i){
scanf("%lld", &a[i]);
}
ll l = -1, r = g;
while(r > l + 1){
ll mid = (l + r) / 2;
if(judge(mid)) r = mid;
else l = mid;
}
printf("Case #%d: %lld\n", tt, r);
}
return 0;
}