quantity = int(input()) days_left = int(input()) price = 0 spirit = 0 for day in range(1,days_left+1): if day % 11 == 0: quantity += 2 if day % 10 == 0 and day == days_left: spirit -= 30 if day % 2 == 0: price += 2 * quantity spirit += 5 if day % 3 == 0: price += (5 * quantity) + (3 * quantity) spirit += 13 if day % 5 == 0: price += 15 * quantity spirit += 17 if day % 3 == 0: spirit += 30 if day % 10 == 0: spirit -= 20 price += 5 + 3 + 15 print(f"Total cost: {price}") print(f"Total spirit: {spirit}")