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

a,b,c,d,e = map(int, input().split())
sum=a+b+c+d+e
numj=0
if (a%2==1):
    numj+=1
if (b % 2 == 1):
    numj += 1
if (c % 2 == 1):
    numj += 1
if (d % 2 == 1):
    numj += 1
if (e % 2 == 1):
    numj += 1
numo=5-numj
if (sum%5 == 0):
    t1=0
    t2=0
    bb=int(sum/5)
    if (a<bb):
        t1+=bb-a
    else:
        t2+=a-bb
    if (b < bb):
        t1 += bb - b
    else:
        t2 += b - bb
    if (c < bb):
        t1 += bb - c
    else:
        t2 += c - bb
    if (d < bb):
        t1 += bb - d
    else:
        t2 += d - bb
    if (e < bb):
        t1 += bb - e
    else:
        t2 += e - bb
    if (t1==t2):
        if (bb % 2 == 1):
            if (numo == 0 or numo == 2 or numo == 4):
                print(bb)
            else:
                print(-1)
        else:
            if (numj == 0 or numj == 2 or numj == 4):
                print(bb)
            else:
                print(-1)
    else:
        print(-1)
else:
    print(-1)



























