a = input()
b = input()
l = input()
N = input()
int(a)
int(b)
int(l)
int(N)
lenl = 2 * l
lena = (2 * N - 1) * a
lenb = 2*b *(N - 1)
sumlab = lenl + lena + lenb
print(sumlab)
a = input()
b = input()
l = input()
N = input()
a = int(a)
b = int(b)
l = int(l)
N = int(N)
lenl = 2 * l
lena = (2 * N - 1) * a
lenb = 2*b *(N - 1)
sumlab = lenl + lena + lenb
print(sumlab)
a = int(input())
b = int(input())
l = int(input())
N = int(input())
lenl = 2 * l
lena = (2 * N - 1) * a
lenb = 2*b *(N - 1)
sumlab = lenl + lena + lenb
print(sumlab)