#K9971. Central Intersections in a Grid

    ID: 39148 Type: Default 1000ms 256MiB

Central Intersections in a Grid

Central Intersections in a Grid

You are given a grid with n rows and m columns. In this grid, a central intersection is defined based on the parity (evenness or oddness) of n and m:

  • If both n and m are even, the grid has 4 central intersections, forming a 2×2 block at the center (i.e. when n = 4 and m = 4, the answer is 4).
  • If both n and m are odd, there is exactly 1 central intersection (e.g. when n = 5 and m = 5, the answer is 1).
  • If one of n or m is odd and the other is even, there are no central intersections.

Formally, the answer can be given as: \[ \text{answer} = \begin{cases} 4, & \text{if } n \text{ and } m \text{ are even} \\ 1, & \text{if } n \text{ and } m \text{ are odd} \\ 0, & \text{otherwise} \end{cases} \]

inputFormat

The input consists of a single line containing two space-separated integers:

n m

where n denotes the number of rows and m denotes the number of columns of the grid.

outputFormat

Output a single integer which is the number of central intersections in the grid.

## sample
4 4
4