#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int M, N, t, ans;
  scanf(" %d %d", &M, &N);
  if (M > N) {
    t = M;
    M = N;
    N = t;
  }
  if (M >= 3) {
    ans = (M * N + 1) / 2;
  } else if (M == 2) {
    switch (N % 4) {
    case 0:
      ans = N;
      break;
    case 2:
      ans = N + 2;
      break;
    case 1:
    case 3:
      ans = N + 1;
      break;
    }
  } else {
    ans = N;
  }
  printf("%d\n", ans);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1161 <main+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1185 <main+0x65>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
jmp    11f8 <main+0xd8>
cmpl   $0x2,-0x8(%rbp)
jne    11ed <main+0xcd>
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x3,%edx
test   %eax,%eax
mov    %eax,%ecx
cmovs  %edx,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     11e8 <main+0xc8>
mov    -0x20(%rbp),%rax
lea    0xe43(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11e8 <main+0xc8>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    11e8 <main+0xc8>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f3 <main+0xd3>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11f8 <main+0xd8>
mov    -0x14(%rbp),%esi
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    (%rsp),%eax
cmp    %eax,%ecx
jle    1176 <main+0x56>
mov    %eax,0x4(%rsp)
mov    %ecx,(%rsp)
mov    %ecx,%esi
cmp    $0x3,%eax
jge    117f <main+0x5f>
cmp    $0x2,%eax
jne    1196 <main+0x76>
lea    0x3(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
and    $0xfffffffc,%ecx
mov    %esi,%eax
sub    %ecx,%eax
cmp    $0x1,%eax
je     1193 <main+0x73>
cmp    $0x3,%eax
je     1193 <main+0x73>
cmp    $0x2,%eax
jne    1196 <main+0x76>
add    $0x2,%esi
jmp    1196 <main+0x76>
mov    %eax,%esi
mov    %ecx,%eax
cmp    $0x3,%eax
jl     114e <main+0x2e>
imul   %eax,%esi
mov    %esi,%eax
add    $0x1,%eax
shr    $0x1f,%eax
add    %eax,%esi
add    $0x1,%esi
sar    %esi
jmp    1196 <main+0x76>
add    $0x1,%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c" %d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp sgt i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load i32, i32* %2
store i32 %11, i32* %4
%12 = load i32, i32* %3
store i32 %12, i32* %2
%13 = load i32, i32* %4
store i32 %13, i32* %3
br label %14
14: ; preds = %10, %0
%15 = load i32, i32* %2
%16 = icmp sge i32 %15, 3
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = mul nsw i32 %18, %19
%21 = add nsw i32 %20, 1
%22 = sdiv i32 %21, 2
store i32 %22, i32* %5
br label %41
23: ; preds = %14
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %38
26: ; preds = %23
%27 = load i32, i32* %3
%28 = srem i32 %27, 4
switch i32 %28, label %37 [
i32 0, label %29
i32 2, label %31
i32 1, label %34
i32 3, label %34
]
29: ; preds = %26
%30 = load i32, i32* %3
store i32 %30, i32* %5
br label %37
31: ; preds = %26
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 2
store i32 %33, i32* %5
br label %37
34: ; preds = %26, %26
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %37
37: ; preds = %26, %34, %31, %29
br label %40
38: ; preds = %23
%39 = load i32, i32* %3
store i32 %39, i32* %5
br label %40
40: ; preds = %38, %37
br label %41
41: ; preds = %40, %17
%42 = load i32, i32* %5
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c" %d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 %7, i32* %1
store i32 %6, i32* %2
br label %10
10: ; preds = %9, %0
%11 = phi i32 [ %6, %9 ], [ %7, %0 ]
%12 = phi i32 [ %7, %9 ], [ %6, %0 ]
%13 = icmp sgt i32 %12, 2
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = mul nsw i32 %11, %12
%16 = add nsw i32 %15, 1
%17 = sdiv i32 %16, 2
br label %26
18: ; preds = %10
%19 = icmp eq i32 %12, 2
br i1 %19, label %20, label %26
20: ; preds = %18
%21 = srem i32 %11, 4
switch i32 %21, label %26 [
i32 3, label %24
i32 2, label %22
i32 1, label %24
]
22: ; preds = %20
%23 = add nsw i32 %11, 2
br label %26
24: ; preds = %20, %20
%25 = add nsw i32 %11, 1
br label %26
26: ; preds = %18, %20, %24, %22, %14
%27 = phi i32 [ %17, %14 ], [ %25, %24 ], [ %23, %22 ], [ %11, %20 ], [ %11, %18 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
ret i32 0
}