Positioning Peter’s Paintings
시간 제한2초메모리 제한2048 MB
직립한 두 직사각형 그림의 밑변과 높이가 주어질 때, 두 그림을 겹치지 않게 담는 직사각형 벽의 최소 둘레를 구한다.
문제
Peter the painter just finished painting two rectangular paintings and would like to display both on a rectangular wall which has the smallest perimeter possible. The first painting has a base of length units and a height of length units. The second painting has a base of length units and a height of length units.
Peter has a few conditions on how to arrange his paintings on the rectangular wall. The first condition is that the paintings must be upright, meaning that the bases of the paintings are parallel to the floor. The second condition is that he would like to display both paintings in full, meaning that they cannot overlap each other. Please help determine the rectangular wall of minimum perimeter such that the paintings can be displayed without violating his conditions.
입력
The one line of input will consist of four space-separated positive integers, , , , ().
출력
Output a single integer representing the minimum perimeter of a rectangular wall without violating Peter’s conditions.