SP27198 IAPCR2E - Ballons Revisited

Description

You have w white, r red, g green and b blue balloons. To make a single student happy you need exactly four balloons. All four balloons given to a student shouldn't have the same color. What is the maximum number S of happy students if we know number of balloons of each color? Your task is to write a program that for given values w,r, g and b will find the S.

Input Format

Input starts with an integer T ( Each test case contains four integers w,r, g and b (0

Output Format

For each test case print a single integer S — maximum number of happy students.