#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define out(x) cout<<(#x)<<'='<<x<<endl;
typedef long long LL;
LL R[4], r[4], F, f, p, P, n, curr, T;
int x, t, ok;
const LL INF=0x7fffffffffffffffLL;
inline LL mul(const LL &a, const LL &b){
	if(!a || !b)return 0;
	if(a>INF/b)return INF;
	else return a*b;
}
inline LL add(const LL &a, const LL &b){
	if(a>INF-b)return INF;
	else return a+b;
}
inline LL dv(const LL &a, const LL &p){
	return max(add(a, p-1)/p, 0LL);
}
LL calc(LL f, LL p, LL n){
	return dv(dv(F-f, r[0])+P-p, n);
}
LL gao(LL m, int &ok){
    LL totf=(m-n)*x;
    ok=1;
	LL t1=n+m-1, t2=m-n;
	if(~t1&1)t1>>=1;
	else t2>>=1;
	LL pp=add(mul(mul(t1, t2),t), p);
	if(pp==INF)return ok=0;
	LL cp=dv(totf-f, r[0]);
	return calc(cp*r[0]+f-totf, pp-cp, m);
}
int main()
{
	int cs=0;
	while(scanf("%I64d%I64d%I64d%I64d", r, r+1, r+2, r+3)==4){
		scanf("%I64d%I64d%I64d%I64d", R, R+1, R+2, R+3);
		LL ans=INF;
		cin>>n>>x>>t;
		F=R[0]; P=dv(R[1], r[1])+dv(R[2], r[2])+dv(R[3], r[3]);
		f=p=curr=0;
		LL minn=dv(dv(x, r[0]), t);
		bool flag=false;
		for(;;n++){
		    LL T=calc(f, p, n)+curr;
		    if(ans>T)ans=T;
			else if(ans<T){flag=true;break;}
			LL needp=dv(x-f, r[0]);
			if(needp<=p && n>=minn)break;
			LL needs=dv(needp-p, n)+t;
			curr+=needs;
			f+=needp*r[0]-x;
			p+=n*needs-needp;
		}
		printf("Case %d: ", ++cs);
		if(flag){printf("%I64d\n", ans);continue;}
		LL l=n, h=(ans-curr)/t+n, m, a2;
		for(;l<=h;){
			m=l+((h-l)>>1);
			a2=(T=gao(m, ok))+curr+t*(m-n);
			if(!ok){h=m-1;continue;}
			if((T-t)>dv(x, r[0]))l=m+1;
			else h=m-1;
			if(ans>a2)ans=a2;
		}
		printf("%I64d\n", ans);
	}
}
