## CodeEval
## Trick or Treat

import sys

test_cases = open(sys.argv[1], 'r')

for test in test_cases:
    v, z, w, h = [int(v.split(' ')[1]) for v in test.split(', ')]
    avg = ((3*v + 4*z + 5*w) * h) // (v + z + w)
    sys.stdout.write(str(avg) + '\n')

test_cases.close()

c33074a5d6df065bbbe0472fc3353bb77eb2617f
<mask token>

<mask token>
for test in test_cases:
    v, z, w, h = [int(v.split(' ')[1]) for v in test.split(', ')]
    avg = (3 * v + 4 * z + 5 * w) * h // (v + z + w)
    sys.stdout.write(str(avg) + '\n')
test_cases.close()

<mask token>
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
    v, z, w, h = [int(v.split(' ')[1]) for v in test.split(', ')]
    avg = (3 * v + 4 * z + 5 * w) * h // (v + z + w)
    sys.stdout.write(str(avg) + '\n')
test_cases.close()

import sys
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
    v, z, w, h = [int(v.split(' ')[1]) for v in test.split(', ')]
    avg = (3 * v + 4 * z + 5 * w) * h // (v + z + w)
    sys.stdout.write(str(avg) + '\n')
test_cases.close()

## CodeEval
## Trick or Treat

import sys

test_cases = open(sys.argv[1], 'r')

for test in test_cases:
    v, z, w, h = [int(v.split(' ')[1]) for v in test.split(', ')]
    avg = ((3*v + 4*z + 5*w) * h) // (v + z + w)
    sys.stdout.write(str(avg) + '\n')

test_cases.close()
