20 lines
254 B
Python
20 lines
254 B
Python
import io
|
|
import sys
|
|
|
|
sys.stdin = io.StringIO('''2 3 1 3''') # 26
|
|
|
|
a, h, b, k = map(int, input().split())
|
|
c = 0
|
|
while h > 0 and k > 0:
|
|
c += a
|
|
c += b
|
|
h -= b
|
|
k -= a
|
|
|
|
if h > 0 > k:
|
|
c += a * 10
|
|
elif h <= 0 < k:
|
|
c += b * 10
|
|
|
|
print(c)
|