program change; var a,b,p,t,i: longint; c: array[1..4] of record i,o,n: integer; end; begin c[1].n:=1; c[2].n:=5; c[3].n:=10; c[4].n:=25; while true do begin ReadLn(p,c[1].i,c[2].i,c[3].i,c[4].i); for a := 1 to 4 do c[a].o:=0; if p = 0 then break; t:=0; for a:=1 to 4 do begin t:=t+c[a].n*c[a].i; c[a].o:=c[a].i; if t>p then break; end; if t

0 then begin if i>c[b].o then i:=c[b].o; c[b].o:=c[b].o-i; t:=t-c[b].n*i; end; end; if t>p then writeln('Charlie cannot buy coffee.') else begin writeln('Throw in ',c[1].o,' cents, ', c[2].o,' nickels, ',c[3].o,' dimes, and ',c[4].o,' quarters.'); { writeln(c[1].n*c[1].o+c[2].o*c[2].n+c[3].o*c[3].n+c[4].o*c[4].n); writeln(p);} end; end; { for a:=4 downto 1 do begin c[a].o := p div c[a].n; if c[a].o > c[a].i then c[a].o:=c[a].i; p := p - c[a].n*c[a].o; end; for a:=4 downto 1 do begin end;} end; end.