Stepan and the Trip to the Store
Stepan is preparing for a visit from his friend Vasyl and needs to make a trip to two nearby stores before the meeting.
There are three paths available:
A path from Stepan's house to the first store, measuring
d1
meters.A path from his house to the second store, measuring
d2
meters.A direct path connecting the two stores, measuring
d3
meters.
Your task is to help Stepan determine the shortest distance he needs to travel to visit both stores and return home.
Stepan will start his journey from his house. He must visit both stores, using only the three available paths, and return to his house. He doesn't mind revisiting the same store or retracing his steps if it helps minimize the total distance traveled.
Input
The input consists of a single line with three integers d1
, d2
, and d3
(1 ≤ d1, d2, d3 ≤ 10^8)
, representing the lengths of the paths:
d1
: the distance from Stepan's house to the first store.d2
: the distance from his house to the second store.d3
: the distance between the two stores.
Output
Print the minimum distance, in meters, that Stepan needs to travel to visit both stores and return home.