#P1644. Horse's Jump on a Half Chessboard

    ID: 14930 Type: Default 1000ms 256MiB

Horse's Jump on a Half Chessboard

Horse's Jump on a Half Chessboard

On a half chessboard as shown in Figure 1, a horse (knight) starting at the bottom-left corner \( (0,0) \) jumps toward the top-right corner \( (m,n) \). The horse is only allowed to move in a rightward direction using one of the following two moves:

\( (x,y)\to (x+1,y+2) \)

\( (x,y)\to (x+2,y+1) \)

Your task is to count the number of distinct paths the horse can take to reach \( (m,n) \) from \( (0,0) \) using these moves.

inputFormat

The input consists of two space-separated integers \( m \) and \( n \) which denote the coordinates of the destination.

outputFormat

Output a single integer representing the number of distinct paths from \( (0,0) \) to \( (m,n) \) that follow the allowed moves.

sample

3 3
1