P27706 [洛谷] [ICPC2024 Xi'an I] Triangle
入门
题目描述

Problem Description

In the plane rectangular coordinate system, there are three points \( A(a, 0) \), \( B(0, b) \), and \( C(0, 0) \). The size of triangle \( ABC \) is defined as the number of squares that belong to it.

For integers \( x, y \), a square is defined by four points \( (x, y) \), \( (x + 1, y) \), \( (x, y + 1) \), \( (x + 1, y + 1) \). We consider a square to belong to a triangle if half or more of it is inside the triangle.

For example, when \( a = 8, b = 6 \), the size of triangle \( ABC \) will be 24. The image below shows which squares are counted in the triangle.

Input Format

The first and only line contains two integers \( a \) (\( 1 \le a \le 10^6 \)) and \( b \) (\( 1 \le b \le 10^6 \)).

Output Format

Print an integer: the size of triangle \( ABC \).

Sample Input and Output

Sample Input #1

6 8

Sample Output #1

24

Sample Input #2

5 5

Sample Output #2

15

Sample Input #3

1 999999

Sample Output #3

500000
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 8
样例输出
24