Mirko doesn't like Latin homeworks so he made a bet with Slavko. The loser will be writing homeworks for both of them for the entire month. Mirko wants to win so he designed this problem they could have something to bet on.
At his desk, he found a cube with numbers to on its faces. A cube is shown in the picture. Additionally, the sum of numbers on opposing faces is equal to . That means that is on the opposite face of , on the opposite of and on the opposite face of .
Mirko has put the cube in the upper left field of the matrix of rows and columns. The cube is initially oriented in a way that the upper side is showing number , and the side to the right number .
Mirko now makes the following moves:
- He rolls the cube to the right, until it reaches the last column
- Then he rolls it down (to the next row)
- Now he rolls the cube to the left, until it reaches first column
- Like in step , he rolls it down (to the next row)
Mirko is repeating these steps for as long as he can, i.e. as long as he can roll the cube in the next row. When a cube reaches some field, Mirko writes down the number on the top of the cube. In the end, he sums all of the numbers he had written.
Mirko made a bet with Slavko that he could calculate that sum without error. Help Slavko verifying Mirko's solution!
Input Specification
First and only line of input contains two positive integers. and , matrix dimensions.
Output Specification
First and only line of input should contain the sum described in the task.
Scoring
In test cases worth of total points, and will be less than or equal to .
Sample Input 1
3 2
Sample Output 1
19
Explanation for Sample Output 1
The numbers Mirko wrote down are:
Sample Input 2
3 4
Sample Output 2
42
Sample Input 3
737 296
Sample Output 3
763532
Comments