program solitario;
var N,M,app, soluzione:longint;
griglia:array[0..10,0..10] of longint;
function gioca(r, c: longint): boolean;
begin
(*tris orizzontale*)
if (c-2>=0) and (griglia[r][c-2]=1) and (griglia[r][c-1]=1) then gioca:=false
(*tris verticale*)
else if (r-2>=0) and (griglia[r-2][c]=1) and (griglia[r-1][c]=1) then gioca:=false
(* Tris diagonale in alto a sx*)
else if (r-2>=0 ) and (c-2>=0) and (griglia[r-2][c-2]=1) and (griglia[r-1][c-1]=1) then gioca:=false
(* Tris diagonale in alto a dx*)
else if (r-2>=0) and (c+2<=M) and (griglia[r-2][c+2]=1) and (griglia[r-1][c+1]=1) then gioca:=false
else gioca := true;
end;
Procedure riempi (riga:longint; colonna:longint; tot:longint);
begin
if colonna=M then begin riga:=riga+1; colonna:=0; end;
if riga=N then begin if tot>soluzione then soluzione:=tot; exit end;
(*Se posso, metto la X*)
if gioca (riga,colonna)=true then
begin
griglia[riga][colonna]:=1;
Riempi(riga,colonna+1, tot+1);
(* Reset della griglia[riga][col]*)
griglia[riga][colonna]:=0;
end;
(* Non metto la X*)
Riempi(riga,colonna+1, tot);
end;
begin
readln(N,M);
if N*M>30 then soluzione:=N*M*11 div 20 +1
else begin soluzione:=0; riempi(0,0,0); end;
writeln(soluzione);
end.
cHJvZ3JhbSBzb2xpdGFyaW87CnZhciBOLE0sYXBwLCBzb2x1emlvbmU6bG9uZ2ludDsKICAgIGdyaWdsaWE6YXJyYXlbMC4uMTAsMC4uMTBdIG9mIGxvbmdpbnQ7CiAgICAKZnVuY3Rpb24gZ2lvY2EociwgYzogbG9uZ2ludCk6IGJvb2xlYW47CmJlZ2luCiAgICAgICgqdHJpcyBvcml6em9udGFsZSopCiAgIGlmIChjLTI+PTApIGFuZCAoZ3JpZ2xpYVtyXVtjLTJdPTEpIGFuZCAoZ3JpZ2xpYVtyXVtjLTFdPTEpIHRoZW4gZ2lvY2E6PWZhbHNlCiAgICAgICgqdHJpcyB2ZXJ0aWNhbGUqKQogICAgICBlbHNl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Z2EsY29sb25uYSsxLCB0b3QrMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgqIFJlc2V0IGRlbGxhIGdyaWdsaWFbcmlnYV1bY29sXSopCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBncmlnbGlhW3JpZ2FdW2NvbG9ubmFdOj0wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQ7CiAgICAgKCogTm9uIG1ldHRvIGxhIFgqKQogICAgUmllbXBpKHJpZ2EsY29sb25uYSsxLCB0b3QpOwogIAplbmQ7ICAgICAgICAgICAgICAgICAgIApiZWdpbgoJcmVhZGxuKE4sTSk7CglpZiBOKk0+MzAgdGhlbiBzb2x1emlvbmU6PU4qTSoxMSBkaXYgMjAgKzEKCSAgICAgICAgICBlbHNlICBiZWdpbiBzb2x1emlvbmU6PTA7IHJpZW1waSgwLDAsMCk7IGVuZDsKICAgIHdyaXRlbG4oc29sdXppb25lKTsJICAgICAgICAgIAplbmQuCg==