A, B, C, X = int(eval(input())), int(eval(input())), int(eval(input())), int(eval(input()))

cnt = 0

for n_500 in range(A + 1):

    for n_100 in range(B + 1):

        for n_50 in range(C + 1):

            if n_500 * 500 + n_100 * 100 + n_50 * 50 == X:

                cnt += 1

print(cnt)
A = int(eval(input()))  # 500円玉の枚数

B = int(eval(input()))  # 100円玉の枚数

C = int(eval(input()))  # 50円玉の枚数

X = int(eval(input()))  # 合計X円にしたい



ans = 0

for a in range(min(A+1, X//500+1)):

    x = X - 500 * a

    for b in range(min(B+1, X//100+1)):

        xx = x - 100 * b

        if (xx/50).is_integer() and xx//50 <= C and xx//50 >= 0:

            ans += 1

            

print(ans)
A, B, C, X = (
    int(eval(input())),
    int(eval(input())),
    int(eval(input())),
    int(eval(input())),
)
cnt = 0
for n_500 in range(A + 1):
    for n_100 in range(B + 1):
        for n_50 in range(C + 1):
            if n_500 * 500 + n_100 * 100 + n_50 * 50 == X:
                cnt += 1
print(cnt)

A = int(eval(input()))  # 500円玉の枚数
B = int(eval(input()))  # 100円玉の枚数
C = int(eval(input()))  # 50円玉の枚数
X = int(eval(input()))  # 合計X円にしたい
ans = 0
for a in range(min(A + 1, X // 500 + 1)):
    x = X - 500 * a
    for b in range(min(B + 1, X // 100 + 1)):
        xx = x - 100 * b
        if (xx / 50).is_integer() and xx // 50 <= C and xx // 50 >= 0:
            ans += 1
print(ans)

-A, B, C, X = ( -    int(eval(input())), -    int(eval(input())), -    int(eval(input())), -    int(eval(input())), -) -cnt = 0 -for n_500 in range(A + 1): -    for n_100 in range(B + 1): -        for n_50 in range(C + 1): -            if n_500 * 500 + n_100 * 100 + n_50 * 50 == X: -                cnt += 1 -print(cnt) +A = int(eval(input()))  # 500円玉の枚数 +B = int(eval(input()))  # 100円玉の枚数 +C = int(eval(input()))  # 50円玉の枚数 +X = int(eval(input()))  # 合計X円にしたい +ans = 0 +for a in range(min(A + 1, X // 500 + 1)): +    x = X - 500 * a +    for b in range(min(B + 1, X // 100 + 1)): +        xx = x - 100 * b +        if (xx / 50).is_integer() and xx // 50 <= C and xx // 50 >= 0: +            ans += 1 +print(ans)