t = {} t[1], t[2], t[3] = io.read("*n", "*n", "*n") table.sort(t) cnt, a, b = t[1], t[2] - t[1], t[3] - t[1] plan13 = math.floor((b - a) / 2) plan13 = math.min(plan13, math.floor(b / 3)) plan13 = math.min(plan13, a) cnt = cnt + plan13 a = a - plan13 b = b - plan13 * 3 plan44 = math.floor(a / 4) plan44 = math.min(plan44, b / 4) cnt = cnt + plan44 * 2 a = a - plan44 * 4 b = b - plan44 * 4 cand = 0 if(a == 3) then cand = 1 + math.floor((b - 1) / 5) end plan13 = math.min(a, math.floor(b / 3)) plan05 = math.floor((b - plan13 * 3) / 5) cnt = cnt + math.max(cand, plan13 + plan05) print(cnt)