Contest Duration: - (local time) (100 minutes) Back to Home
A - Difference Max /

Time Limit: 2 sec / Memory Limit: 1024 MB

### 問題文

a ≤ x ≤ b,\ c ≤ y ≤ d となるように整数 x, y を選ぶとき、 x - y の最大値を求めてください。

### 制約

• 入力は全て整数
• -100 ≤ a ≤ b ≤ 100
• -100 ≤ c ≤ d ≤ 100

### 入力

a b
c d


### 入力例 1

0 10
0 10


### 出力例 1

10


(x, y) = (10, 0) のとき最大値 x - y = 10 をとります。

### 入力例 2

-100 -100
100 100


### 出力例 2

-200


### 入力例 3

-100 100
-100 100


### 出力例 3

200


Score : 100 points

### Problem Statement

Given are integers a, b, c, and d.
We will choose integers x and y such that a ≤ x ≤ b and c ≤ y ≤ d. Find the maximum possible value of x - y here.

### Constraints

• All values in input are integers.
• -100 ≤ a ≤ b ≤ 100
• -100 ≤ c ≤ d ≤ 100

### Input

Input is given from Standard Input in the following format:

a b
c d


### Sample Input 1

0 10
0 10


### Sample Output 1

10


(x, y) = (10, 0) achieves the maximum value x - y = 10.

### Sample Input 2

-100 -100
100 100


### Sample Output 2

-200


### Sample Input 3

-100 100
-100 100


### Sample Output 3

200