# 2020牛客多校第八场 K. Kabaleo Lite（整体和拆分考虑）

#includebits/stdc++.h
using namespace std;

typedef long long ll;

templatetypename T
T s = 0, f = 1; char ch = getchar();
while(!isdigit(ch)) {if(ch == '-') f = -1; ch = getchar();}
while(isdigit(ch)) {s = (s  3) + (s  1) + ch - '0'; ch = getchar();}
return s * f;
}

inline void print(__int128 x){
if(x  0){
putchar('-');
x = -x;
}
if(x  9) print(x / 10);
putchar(x % 10 + '0');
}

const int N = 1e5 + 10;
const int M = N  1;
ll a[N], b[N];
int n;

inline void prints(__int128 x){
if(x  0){
putchar('-');
x = -x;
}
if(x  9) prints(x / 10);
putchar(x % 10 + '0');
}

void solve(int num) {
for(int i = 1; i = n; i++) a[i] = readl(), a[i] += a[i - 1];
for(int i = 1; i = n; i++) b[i] = readl();
for(int i = 2; i = n; i++) b[i] = min(b[i - 1], b[i]);

__int128 ans = (__int128)a[1] * b[1];
int l = 1, r = 2;

while(r = n) {
while(r = n  a[r] = a[l]) ++r;
if(r == n + 1) break;
ans += (__int128)(b[r]) * (a[r] - a[l]);
l = r;
}

printf("Case #%d: %lld ", num, b[1]);
prints(ans);
puts("");

}

int main()
{
int T = 1;
for(int i = 1; i = T; ++i) {
solve(i);
}
}