C = list(map(int, input().split())) ans = 0 ans += min(C) C = list(map(lambda x: x-ans, C)) C.sort(reverse=True) #descending while C.count(0)==1: temp = min(C[0]//3, C[1]) C[0] -= temp*3 C[1] -= temp ans += temp C.sort(reverse=True) #descending while C.count(1)==2: ans += C[0]//5 print(ans)