AtCoder Beginner Contest 449
D
Make Target 2
AtCoder
⌀ 927
原题
←G →

Make Target 2AI (CI翻译)

Problem Statement

There is a two-dimensional coordinate plane. A lattice point with coordinates $(x, y)$ is painted black if $\max(|x|, |y|)$ is even, and white if it is odd.

Among the pairs of integers $(x, y)$ satisfying $L \leq x \leq R$ and $D \leq y \leq U$, find the number of those for which the point $(x, y)$ is painted black.

Constraints

  • $-10^6 \leq L \leq R \leq 10^6$
  • $-10^6 \leq D \leq U \leq 10^6$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

L R D U

Output

Output the answer.

{"titleZh":"构造目标 2","bodyZh":"## 题目描述\n\n在一个二维坐标平面上,如果格点的坐标为 $(x, y)$,且 $\max(|x|, |y|)$ 为偶数,则该点被涂成黑色;否则被涂成白色。\n\n在满足 $L \\leq x \\leq R$ 且 $D \\leq y \\leq U$ 的整数对 $(x, y)$ 中,求被涂成黑色的点的数量。\n\n## 约束条件\n\n- $-10^6 \\leq L \\leq R \\leq 10^6$\n- $-10^6 \\leq D \\leq U \\leq 10^6$\n- 所有输入值均为整数。\n\n## 输入格式\n\n输入从标准输入按以下格式给出:\n\n\nL R D U\n\n\n## 输出格式\n\n输出答案。"}AI (CI翻译)

样例

Input #1
-4 3 1 3
Output #1
10
![image](https://img.atcoder.jp/abc449/a9ca35222007aa0b64414d2edccc3b5a.png) As shown in the figure above, the answer is $10$.
Input #2
-14 14 -14 14
Output #2
449
题目信息
题号
abc449_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。