#include <iostream>
using namespace std;
int main()
{
int money, time_based, time = 0, order;
bool no_money = 0;
cin >> money >> time_based >> order;
if ((order == 0 && money < 32) || (order == 1 && money < 55)) cout << "Wayne can't eat and drink." << endl;
while (no_money == 0) {
switch (order % 2) {
case 0:
if (money >= 32) {
money -= 32;
if (money == 0) {
cout << time << ": Wayne eats an Apple pie, and now he doesn't have money."<< endl;
}
else if (money == 1) {
cout << time << ": Wayne eats an Apple pie, and now he has " << money << " dollar." << endl;
}
else {
cout << time << ": Wayne eats an Apple pie, and now he has " << money << " dollars." << endl;
}
}
else no_money = 1;
time += time_based;
order += 1;
break;
case 1:
if (money >= 55) {
money -= 55;
if (money == 0) {
cout << time << ": Wayne drinks a Corn soup, and now he doesn't have money."<< endl;
}
else if (money == 1) {
cout << time << ": Wayne drinks a Corn soup, and now he has " << money << " dollar." << endl;
}
else {
cout << time << ": Wayne drinks a Corn soup, and now he has " << money << " dollars." << endl;
}
}
else no_money = 1;
time += time_based;
order += 1;
break;
}
}
return 0;
}