Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his house. There is a d_1 meter long road between his house and the first shop and a d_2 meter long road between his house and the second shop. Also, there is a road of length d_3 directly connecting these two shops to each other. Help Patrick calculate the minimum distance that he needs to walk in order to go to both shops and return to his house. [Image] 

Patrick always starts at his house. He should visit both shops moving only along the three existing roads and return back to his house. He doesn't mind visiting the same shop or passing the same road multiple times. The only goal is to minimize the total distance traveled.


-----Input-----

The first line of the input contains three integers d_1, d_2, d_3 (1 ≤ d_1, d_2, d_3 ≤ 10^8) — the lengths of the paths.   d_1 is the length of the path connecting Patrick's house and the first shop;  d_2 is the length of the path connecting Patrick's house and the second shop;  d_3 is the length of the path connecting both shops. 


-----Output-----

Print the minimum distance that Patrick will have to walk in order to visit both shops and return to his house.


-----Examples-----
Input
10 20 30

Output
60

Input
1 1 5

Output
4



-----Note-----

The first sample is shown on the picture in the problem statement. One of the optimal routes is: house $\rightarrow$ first shop $\rightarrow$ second shop $\rightarrow$ house.

In the second sample one of the optimal routes is: house $\rightarrow$ first shop $\rightarrow$ house $\rightarrow$ second shop $\rightarrow$ house.

Difficulty: interview

Starter code:

Solutions:
d1, d2, d3 = map(int, input().split())
D1 = 2*d1 + 2*d2
D2 = d1 + d3 + d2
D3 = (d1 + d3) * 2
D4 = (d2 + d3) * 2
print(min(D1, D2, D3, D4))

a, b, c = list(map(int, input().split()))

for i in range(100):
	a = min(a, b + c)
	b = min(b, a + c)
	c = min(c, a + b)

print(a + b + c)


a, b, c = map(int, input().split())
print(min(2 * a + 2 * b, a + c + b, 2 * a + 2 * c, 2 * b + 2 * c))

a, b, c = map(int, input().split())
print(min(a + a + b + b, a + c + b, a + c + c + a, b + c + c + b))

import math
from decimal import *
import sys
from fractions import Fraction

n=list(map(int,input().split()))
a=n[0]
b=n[1]
c=n[2]

ans = min([a+b+c,2*a+2*b,2*a+2*c,2*b+2*c])
print(ans)


d1, d2, d3 = [int(i) for i in input().split()]
print(min(2 * (d1 + d2), d1 + d2 + d3, 2 * (d1 + d3), 2 *(d2 + d3)))


#!/usr/bin/env python3

try:
    while True:
        a, b, c = list(map(int, input().split()))
        if a > b:
            a, b = b, a
        d = min(a + b, c)
        print(a + d + min(b, a + d))
except EOFError:
    pass


d1, d2, d3 = map(int, input().split(" "))
res = min(d1+d2+d3, min(2*d2+2*d3, min(2*d1+2*d3, 2*d1+2*d2)))
print(res)

a, b, c = map(int, input().split())

print(min(2 * a + 2 * b, 2 * a + 2 * c, 2 * b + 2 * c, a + b + c))

a, b, c = list(map(int, input().split()))

print(min([a + b + c, a + a + b + b, a + c + c + a, b + c + c + b]))



a, b, c = map(int, input().split())
print(min(a + c + b, 2 * a + 2 * b, 2 * (a + c), 2 * (b + c)))

a, b, c = list(map(int,input().split()))

print(min(min(a+b+c,2*(a+b)), min(2*(a+c),2*(b+c))))


def main():
	d1, d2, d3 = list(map(int, input().split()))

	s = min(d1, d2 + d3) + min(d3, d1 + d2) + min(d2, d3 + d1)

	return s

print(main())


adj = [[0]*3 for x in range(3)]
a,b,c = list(map(int, input().split()))
adj[0][1] = adj[1][0] = a
adj[0][2] = adj[2][0] = b
adj[1][2] = adj[2][1] = c
for k in range(3):
	for i in range(3):
		for j in range(3):
			adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j])
print(adj[0][1] + adj[1][2] + adj[2][0])


a, b, c = [int(i) for i in input().split()]
print(min(a + b + c, a + a + b + b, 2 * a + 2 * c, 2 * b + 2 * c))

d1,d2,d3 = map(int, input().split())

if d1 < d2:
    s = d1
    s += min(d1+d2, d3)
    s += min(d2, d3+d1)
else:
    s = d2
    s += min(d1+d2, d3)
    s += min(d1, d3+d2)

print(s)

#n = int(input())

a, b, c = [int(i) for i in input().split(" ")]
ans = []
ans.append(2*(a+b))
ans.append((min(a, b) + c) * 2)
ans.append(a+b+c)
print(min(ans))

a,b,c=list(map(int,input().split()))

ans = a+b

ans = min(ans,min(a,b)+c)

ans*=2

ans=min(ans,a+b+c)
print(ans)


d1, d2, d3 = map(int, input().split())
ans = min(d1+d2+d3, 2 * d1 + 2 * d3, 2 * d2 + 2 * d3, 2 * d1 + 2 * d2)
print(ans)

def solve( d1 , d2 , d3 ):

    return min( 2*d1 + 2*d2 , d1+d2+d3 , 2*(d1+d3) , 2*(d2+d3) )

def __starting_point():

    d1 , d2 , d3 = [ int(x) for x in input().split() ]
    print( solve( d1 , d2 , d3 ) )
__starting_point()

d = sorted(map(int, input().split()))
print(min(sum(d), 2 * sum(d[:2])))

a, b, c = [int(i) for i in input().split()]
print(min((a + b) * 2, a + b + c, (a + c) * 2, (b + c) * 2))

"""
Codeforces Round 332

Problem 599 A. Patrick and Shopping

@author yamaton
@date 2015-11-20
"""

import itertools as it
import functools
import operator
import collections
import math
import sys

BIGMOD = 1000000007


def solve(d1, d2, d3):
    return min(d1 + d2 + d3, 2*(d1 + d2), 2*(d1 + d3), 2*(d2 + d3))


def p(*args, **kwargs):
    return print(*args, file=sys.stderr, **kwargs)


def main():
    [d1, d2, d3] = map(int, input().strip().split())
    result = solve(d1, d2, d3)
    print(result)


def __starting_point():
    main()

__starting_point()

import copy
import sys

line = input()
v = [int(x) for x in line.split()]

resp = 2*v[0]+2*v[1];
resp = min(resp, 2*v[0]+2*v[2])
resp = min(resp, 2*v[1]+2*v[2])
resp = min(resp, v[0]+v[1]+v[2])
print(resp)

lst = [int(x) for x in input().split()]
ans = lst[0] + lst[1] + lst[2]
ans = min(ans, 2 * lst[0] + 2 * lst[1])
ans = min(ans, 2 * lst[0] + 2 * lst[2])
ans = min(ans, 2 * lst[1] + 2 * lst[2])
print(ans)