#Soda Slurper
sodas = [int(s) for s in input().split()]
has, finds, needs = sodas[0], sodas[1], sodas[2]

poss = has + finds
drank = 0
while poss >= needs:
    drank += poss//needs
    poss = poss//needs + poss%needs

print(drank)

e918968fcdb409328b3cd2c9ad025351306437c0
<mask token>

<mask token>
while poss >= needs:
    drank += poss // needs
    poss = poss // needs + poss % needs
print(drank)

sodas = [int(s) for s in input().split()]
has, finds, needs = sodas[0], sodas[1], sodas[2]
poss = has + finds
drank = 0
while poss >= needs:
    drank += poss // needs
    poss = poss // needs + poss % needs
print(drank)

#Soda Slurper
sodas = [int(s) for s in input().split()]
has, finds, needs = sodas[0], sodas[1], sodas[2]

poss = has + finds
drank = 0
while poss >= needs:
    drank += poss//needs
    poss = poss//needs + poss%needs

print(drank)
