Coffee Machine

Given the number of employees on each of three floors, pick the floor for one coffee machine that minimizes total daily stair time.

Easy2Brute forceMathImplementationInterviewNo attempts yetTime limit1sMemory limit1024 MB

Problem

The new building of the Brazilian Computer Society (SBC) has 3 floors. At certain times of the year the SBC staff drink a lot of coffee, so the SBC board decided to give the staff a new espresso machine. The machine goes on one of the 3 floors, and the floor must be chosen so that people do not lose much time walking up and down the stairs.

Each SBC employee drinks one espresso per day. The employee walks from the floor where they work to the floor with the machine and then back to their desk. Walking up or down one floor takes 1 minute. SBC cares about efficiency, so it wants to place the machine where the total time the staff spend on the stairs is as small as possible.

Choose the floor for the machine and report the smallest possible total stair time.

Input

The first three lines contain three integers A1A_1, A2A_2, A3A_3, one per line (0A1,A2,A310000 \le A_1, A_2, A_3 \le 1000). AiA_i is the number of people who work on floor ii.

Output

Print one line with the total number of minutes spent on the stairs when the machine is placed on the best possible floor.