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