Codeforces Beta Round 39
C
Berland 广场
Berland Square
Codeforces
2300
原题
← BD →

Berland 广场AI (CI翻译)

Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square two sets of concentric circles were painted. Let's call the set of concentric circles with radii $1, 2, ..., *K*$ and the center in the point $(*z*, 0)$ a $(*K*, *z*)$-set. Thus, on the square were painted a $(*N*, *x*)$-set and a $(*M*, *y*)$-set. You have to find out how many parts those sets divided the square into.

去年,世界上最大的广场在 Berland 建成。已知可以将这个广场表示为一个引入了笛卡尔坐标系的无限平面。在广场上绘制了两组同心圆。将圆心位于点 $(*z*, 0)$、半径为 $1, 2, ..., *K*$ 的同心圆集合称为一个 $(*K*, *z*)$-集合。因此,广场上绘制了一个 $(*N*, *x*)$-集合和一个 $(*M*, *y*)$-集合。你需要求出这些集合将广场划分成了多少个部分。AI (CI翻译)

Input

输入格式

AI (CI翻译)

The first line contains integers $*N*, *x*, *M*, *y*$. ($1 ≤ *N*, *M* ≤ 100000,  - 100000 ≤ *x*, *y* ≤ 100000, *x* ≠ *y*$).

第一行包含整数 $*N*, *x*, *M*, *y*$。($1 ≤ *N*, *M* ≤ 100000,  - 100000 ≤ *x*, *y* ≤ 100000, *x* ≠ *y*$)。AI (CI翻译)

Output

输出格式

AI (CI翻译)

Print the sought number of parts.

输出所求的部分数量。AI (CI翻译)

Note

说明

AI (CI翻译)

Picture for the third sample:

第三个样例的图示:AI (CI翻译)

image

image AI (CI翻译)

样例

Input #1
1 0 1 1
Output #1
4
InputCopy OutputCopy
Input #2
1 0 1 2
Output #2
3
InputCopy OutputCopy
Input #3
3 3 4 7
Output #3
17
InputCopy OutputCopy
题目信息
题号
40C
时间限制
2 s
内存限制
256 MB
标签
模拟
数学

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