expected_sum = int(input())
counter_sum_cash = 0
counter_sum_cards = 0
sum_cash = 0
sum_cards = 0
collected_money = 0
count_transactions = 0
input_line = input()
while collected_money < expected_sum:
if input_line == "End":
break
input_line = int(input_line)
count_transactions += 1
if count_transactions % 2 != 0:
if input_line <= 100:
print(f"Product sold!")
counter_sum_cash += 1
sum_cash += input_line
elif input_line > 100:
print(f"Error in transaction!")
elif count_transactions % 2 == 0:
if input_line < 10:
print(f"Error in transaction!")
else:
print(f"Product sold!")
counter_sum_cards += 1
sum_cards += input_line
collected_money = sum_cash + sum_cards
if collected_money >= expected_sum:
break
input_line = input()
if input_line == "End":
print(f"Failed to collect required money for charity.")
if collected_money >= expected_sum:
average_sum_cash = sum_cash / counter_sum_cash
average_sum_cards = sum_cards / counter_sum_cards
print(f"Average CS: {average_sum_cash:.2f}")
print(f"Average CC: {average_sum_cards:.2f}")