#include unsigned int total[4]; unsigned int count[4]; unsigned int price[4] = { 1, 5, 10, 25}; unsigned int x; unsigned int out[4]; int main() { int i; while (1) { new_iter: scanf ("%u%u%u%u%u", &x, &count[0], &count[1], &count[2], &count[3]); if (x == 0) return 0; total[0] = count[0]; total[1] = total[0] + 5 * count[1]; total[2] = total[1] + 10 * count[2]; total[3] = total[2] + 25 * count[3]; for (i = 3; i > 0; i--) { if (x >= total[i - 1]) { out[i] = (x - total[i - 1] + price[i] - 1) / price[i]; x -= price[i] * out[i]; } else out[i] = 0; } if (x > count[0]) { printf ("Charlie cannot buy coffee.\n"); } else { out[0] = x; printf ("Throw in %u cents, %u nickels, %u dimes, and %u quarters.\n", out[0], out[1], out[2], out[3]); } } }