Border Cells
Time limit1sMemory limit1024 MB
Given the dimensions m and n of a rectangle on a grid, count how many cells lie on its border.
- Level
Easy1 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Anya has a grid sheet of paper, and on it she drew a rectangle of size .
Then she colored the cells of the rectangle that lie on its border.

How many cells did Anya color?
Input
The first line contains an integer ().
The second line contains an integer ().
Output
Print one integer, the number of cells Anya colored.