Your company can make of the available trades on any given day. They have a list of potential profits for the three trades available for each of the past days, and want to know what the maximum possible profit for any of these days would've been so they can make better trade decisions in the future.

For each prior day , you're given three integers, , , and , denoting the profits that could've been made from each of that day's three available trades. You must analyze this data and determine the maximum profit your company could've earned by making exactly trades during each day . Then print a single integer denoting the maximum of these daily maximum potential profits.

Input Format

The first line contains a single integer, , denoting the number of days you must calculate the best possible trades for.
Each line of the subsequent lines contains three space-separated integers describing the respective values of , , and denoting the profits for the three possible trades for the prior day.

Constraints

Output Format

Print a single integer denoting the maximum possible profit that can be made from performing exactly two of the three available trades during one of the prior days.

Sample Input

2
1 2 3
3 3 0

Sample Output

6

Explanation

There are days to analyze:

  1. The maximum profit on the first day would be from making the second and third trades for a total profit of .
  2. The maximum profit for the second day would be from making the first and second trades for a total profit of .

We then print the maximum of these maximum possible profits for the prior days, which is , on a new line.

Line: 1 Col: 1
  1. Challenge Walkthrough
    Let's walk through this sample challenge and explore the features of the code editor.1 of 6
  2. Review the problem statement
    Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
  3. Choose a language
    Select the language you wish to use to solve this challenge.3 of 6
  4. Enter your code
    Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
  5. Test your code
    You can compile your code and test it for errors and accuracy before submitting.5 of 6
  6. Submit to see results
    When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
  1. Check your score