Chess Snipers
In response to the intensifying situation on the first and third fronts of the chessboard, which consists of n×m squares, the commander-in-chief of the white army has decided to deploy a new combat unit: the chess sniper.
A chess sniper is a piece that attacks in one fixed direction—either forward, backward, left, or right—once placed on a square of the board. Before these snipers can be deployed in battle, it is essential to determine the maximum number of such pieces that can be placed on an empty chessboard of size n×m without any of them attacking each other.
Input
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 1000).
Output
Output a single number on the first line, representing the maximum number of snipers that can be placed on the board without them attacking each other.