You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if we know number of balloons of each color?

Your task is to write a program that for given values r, g and b will find the maximum number t of tables, that can be decorated in the required manner.


-----Input-----

The single line contains three integers r, g and b (0 ≤ r, g, b ≤ 2·10^9) — the number of red, green and blue baloons respectively. The numbers are separated by exactly one space.


-----Output-----

Print a single integer t — the maximum number of tables that can be decorated in the required manner.


-----Examples-----
Input
5 4 3

Output
4

Input
1 1 1

Output
1

Input
2 3 3

Output
2



-----Note-----

In the first sample you can decorate the tables with the following balloon sets: "rgg", "gbb", "brr", "rrg", where "r", "g" and "b" represent the red, green and blue balls, respectively.

Difficulty: interview

Starter code:

Solutions:
r, g, b = map(int, input().split())
maxi = (r + g + b) // 3
print(min(maxi, r + g, r + b, g + b))

x,y,z=list(map(int,input().split()))
L=[x,y,z]
L.sort()
x=L[2]
y=L[1]
z=L[0]
n=2*y+2*z
a=-1
b=y+z+1
while(b-a>1):
    e=(b+a)//2
    if(n-2*e<=x+e):
        b=e
    else:
        a=e

print(min((n-2*b)//2,(x+b)//2))


r, g, b = tuple(map(int, input().split()))
 
if (r > 2 * (g + b)):
	r = 2 * (g + b)
if b > 2 * (g + r):
	b = 2 * (g + r)
if g > 2 * (r + b):
	g = 2 * (r + b)
print(int((g + r + b) / 3))

c = sorted(list(map(int,input().split())))
if c[0] + c[1] >= c[2]//2 :
    print(sum(c)//3)
else :
    print(c[0] + c[1])


"""
Codeforces Contest 273 Div 2 Problem C

Author  : chaotic_iak
Language: Python 3.3.4
"""

def main():
    a = read()
    a.sort()
    res = 0
    if a[1]-a[0] <= a[2]-a[1]:
        res += a[1]-a[0]
        a[1] -= res
        a[2] -= 2*res
        if 4*a[0] <= a[2]:
            print(res + 2*a[0])
            return
        else:
            n = (a[2] - a[0]) // 3
            res += 2*n
            a[0] -= n
            a[1] -= n
            a[2] -= 4*n
            if 0 < a[0] == a[2] - 2:
                res += 1
                a[0] -= 1
                a[2] -= 2
            print(res + a[0])
            return
    else:
        res += a[2]-a[1]
        a[1] -= res
        a[2] -= 2*res
        n = (a[1] - a[0]) // 3
        res += 2*n
        a[1] -= 3*n
        a[2] -= 3*n
        if a[1] == a[0]+2:
            res += 1
            a[1] -= 2
            a[2] -= 1
        print(res + a[0])
        return

################################### NON-SOLUTION STUFF BELOW

def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    inputs = input().strip()
    if mode == 0: return inputs
    if mode == 1: return inputs.split()
    if mode == 2: return list(map(int, inputs.split()))

def write(s="\n"):
    if s is None: s = ""
    if isinstance(s, list): s = " ".join(map(str, s))
    s = str(s)
    print(s, end="")

import itertools
write(main())

c=list(map(int,input().split()))
c.sort()
print(c[0]+c[1] if c[0]+c[1]<=c[2]//2 else sum(c)//3)

a,b,c=map(int,input().split())
x=max(a,b,c)
if x>2*(a+b+c-x):
    print (a+b+c-x)
else:
    print((a+b+c)//3)

r,g,b=map(int,input().split())
print(min(r+g,r+b,b+g,(r+b+g)//3))

import sys
f = sys.stdin
#f = open('H:\\Portable Python 3.2.5.1\\test_248B1.txt') 

#r, g, b = map(int, f.readline().strip().split())
a = [int(u) for u in f.readline().strip().split()]

a.sort(reverse=True)

t = a[2]

dt = min(a[0]-a[1], 2*t) // 2
a[2] -= dt
a[0] -= 2*dt
a[0] -= a[2]
a[1] -= a[2]

t += min((a[0]+a[1]) // 3, a[1])

print(t)


c = sorted(list(map(int,input().split())))
if c[0] + c[1] >= c[2]//2 :
    print(sum(c)//3)
else :
    print(c[0] + c[1])

balloons = list(map(int, input().split(' ')))
balloons.sort()
a, b, c = list(map(int, balloons))
if a + b <= int(c/2):
    print(a+b)
else:
    print((a+b+c) // 3)


# your code goes here
r,g,b = map(int,input().split())
print (min(r+g,g+b,b+r,(r+g+b)//3))

a, b, c = list(map(int, input().split()))
if max(a, b, c) >= 2 * (a + b + c - max(a, b, c)):
    print(a + b + c - max(a, b, c))
else:
    print((a + b + c) // 3)


a = sorted(list(map(int, input().split())))
a[2] = min ( a[2], (a[0]+a[1])*2 )
print( (a[0]+a[1]+a[2]) // 3 )


import sys

fin = sys.stdin
fout = sys.stdout

a = list(map(int, fin.readline().strip().split()))
a.sort()
ans = 0
t = min(a[0], (a[2] - a[1]) // 2)
ans += t
a[0] -= t
a[2] -= 2 * t
ans += a[0]
a[1] -= a[0]
a[2] -= a[0]
t = min(a[1], a[2] - a[1])
ans += t
a[1] -= t
a[2] -= 2 * t
t = a[1] // 3 * 2
ans += t
a[1] -= t // 2 * 3
a[2] -= t // 2 * 3
if a[1] > 0 and a[1] + a[2] >= 3:
    ans += 1
print(str(ans), file=fout)





a = sorted(map(int, input().split()))
if (a[0] + a[1]) * 2 < a[2]:
    print(a[0] + a[1])
else:
    print(sum(a) // 3)


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



3

c = list(map(int, input().split()))
c.sort()
print(min(sum(c) // 3, c[0] + c[1]))

3

c = list(map(int, input().split()))
print(min(sum(c) // 3, sum(c) - max(c)))

r, g, b = sorted(map(int, input().split()))
left = 0
right = b + 1
while right - left > 1:
    m = (right + left) // 2
    if m + min(m, b - m) + r + g >= 3 * m:
        left = m
    else:
        right = m
print(left)


r, g, b = sorted(tuple(map(int, input().split())))
print(min(r + g, (r + g + b) // 3))

r,g,b=map(int,input().split())
print(min(r+g,r+b,b+g,(r+b+g)//3))

r, g, b = list(map(int, input().split()))
z = min(r + g + b, 3 * min(r + b, min(g + b, g + r)))
print(z // 3)


color=list(map(int, input().split()))
color=sorted(color)
if color[2]>=2*(color[0]+color[1]): print(color[0]+color[1])
else: 
    summ=0; 
    for i in color: summ+=i; 
    print(summ//3)