시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 241 162 147 68.692%

문제

4명의 친구가 탁구를하고있다. 각각은 정수형으로 표현된 스킬 레벨을 가지고 있고, 숫자가 높을수록 더 좋은 플레이어다.

4명의 친구는 각각 두명씩 구성된 두 팀을 구성하려고 한다. 게임이 더 흥미롭게 하기 위해서 팀의 스킬 레벨을 최대한 가깝게 유지하기를 원한다. 팀의 스킬 레벨은 팀원의 스킬 레벨의 합계이다.

그들은 탁구 선수로는 탁월하지만, 수학이나 컴퓨터와 같은 다른 것들에 능숙하지 않아 팀의 스킬 레벨이 가능한 작은 차이를 갖도록 도와 주자.

입력

입력은 네 개의 정수 A, B, C 및 D가 포함 된 한 줄로 구성되며 4 명의 스킬 레벨을 낸다 (0 ≤ A ≤ B ≤ C ≤ D ≤ 104).

출력

두 팀의 스킬 레벨 차이가 가장 작은 수를 출력한다.

예제 입력 1

4 7 10 20

예제 출력 1

7

예제 입력 2

0 0 1 1000

예제 출력 2

999

예제 입력 3

1 2 3 4

예제 출력 3

0

힌트

W3sicHJvYmxlbV9pZCI6IjEzODY2IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVkMzAwIFx1YjA5OFx1YjIwNFx1YWUzMCIsImRlc2NyaXB0aW9uIjoiPHA+NFx1YmE4NVx1Yzc1OCBcdWNlNWNcdWFkNmNcdWFjMDAgXHVkMGMxXHVhZDZjXHViOTdjXHVkNTU4XHVhY2UwXHVjNzg4XHViMmU0LiBcdWFjMDFcdWFjMDFcdWM3NDAgXHVjODE1XHVjMjE4XHVkNjE1XHVjNzNjXHViODVjIFx1ZDQ1Y1x1ZDYwNFx1YjQxYyBcdWMyYTRcdWQwYWMgXHViODA4XHViY2E4XHVjNzQ0IFx1YWMwMFx1YzljMFx1YWNlMCBcdWM3ODhcdWFjZTAsIFx1YzIyYlx1Yzc5MFx1YWMwMCBcdWIxOTJcdWM3NDRcdWMyMThcdWI4NWQgXHViMzU0IFx1Yzg4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