99 100 100 100 100
 57 83 11 4 93
 99 99 99 99 99
 100 0 0 0 0
 0 1 2 3 4
 93 100 99 90 98
 87 38 19 33 100
 1 1 1 1 1
 0 0 0 0 1
 2 3 4 5 6
 1 2 1 2 3
 0 0 0 0 0
 100 100 100 100 100
 43 83 1 0 23
 43 83 1 100 23
 56 0 0 0 4
 99 98 98 99 100

-1
 -1
 99
 20
 2
 96
 -1
 1
 -1
 4
 -1
 -1
 100
 30
 50
 12
 -1

c1, c2, c3, c4, c5 = [int(x) for x in input().split()]

b = sum([c1, c2, c3, c4, c5]) / 5

if b != int(b) or b == 0:
    print(-1)
    exit()

ic1, ic2, ic3, ic4, ic5 = [int(b)] * 5

while ic1 != c1:
    if ic1 > c1:
        ic1 -= 1
        ic2 += 1
    else:
        ic1 += 1
        ic2 -= 1

while ic2 != c2:
    if ic2 > c2:
        ic2 -= 1
        ic3 += 1
    else:
        ic2 += 1
        ic3 -= 1

while ic3 != c3:
    if ic3 > c3:
        ic3 -= 1
        ic4 += 1
    else:
        ic3 += 1
        ic4 -= 1

while ic4 != c4:
    if ic4 > c4:
        ic4 -= 1
        ic5 += 1
    else:
        ic4 += 1
        ic5 -= 1

if ic5 == c5:
    print(int(b))
else:
    print(-1)