휴가날에 맞춰서 캠핑을 시작한다고 가정해서, 진행되는 구간을 최대한도로 확보하자. 남은 기간 동안 진행 가능한 일이 남아 있다면 실행하자.
import sys
case_num = 1
while True:
    l, p, v = map(int, sys.stdin.readline().rstrip().split())
    if l == 0 and p == 0 and v ==0: break
    total = 0
    bound, rest = divmod(v, p)
    total += bound * l
    total += min(rest, l)
    print(f"Case {case_num}: {total}")
    case_num += 1