#C1083. Maximum Fence Posts
Maximum Fence Posts
Maximum Fence Posts
You are given a rectangular field with a width w and a height h.
Your task is to compute the maximum number of fence posts that can be used to fence off any sub-rectangle inside the field. The fence posts are placed along the boundary at integral coordinate points. The optimal solution is to select the entire field as the sub-rectangle, and the number of posts used will be equal to the perimeter of the rectangle.
The perimeter of a rectangle is given by the formula: \(2(w+h)\).
Example: For a field of dimensions 4 and 3, the maximum number of fence posts is \(2(4+3)=14\).
inputFormat
The input consists of a single line with two space-separated integers w and h, representing the width and height of the field, respectively.
outputFormat
Output a single integer representing the maximum number of fence posts that can be used, computed as \(2(w+h)\).
## sample4 3
14