Under construction

Still being built. Things may change

Placing Game Pieces

Time limit1sMemory limit1024 MB

Summary
Given a board N cells wide and M cells tall, count the unordered pairs of cells that touch each other diagonally.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

The game board is NN cells wide and MM cells tall. Count the ways to place two identical game pieces on the board so that they are diagonally adjacent to each other.

The figure below shows the case N=3N = 3, M=2M = 2.

Input

The first line contains the width NN of the board. (1≤N≤40)(1 \le N \le 40)

The second line contains the height MM of the board. (1≤M≤40)(1 \le M \le 40)

Output

Print the number of ways to place the pieces so that the condition above is satisfied.

Hint

Every way for the first example is shown in the figure above.

In the second example, the two pieces cannot be placed diagonally adjacent to each other, so the answer is 00.

Examples3

  1. Example 1

    Input
    3
    2
    
    Expected output
    4
    
  2. Example 2

    Input
    30
    1
    
    Expected output
    0
    
  3. Example 3

    Input
    13
    27
    
    Expected output
    624