Andrea loves collecting pebbles.
  She has  pebbles labeled from 
 to 
. 
  The pebble labeled  has its lovely value 
, lively value 
, and lucky value 
 
. 
  
 
She wants to select some pebbles.
  If she chooses  pebbles labeled 
 
, the happy value she can obtain will be 
   
Andrea wants to know the maximal happy value she can obtain.
Andrea must pick at least one pebble.
The input consists of:
One line containing one integer
.
Each of the next
lines contains three integers
.
Output the answer.