cho.sh
Notes
Loading...

Dice Game

Time limit

1s

Memory limit

128 MB

Problem

Three dice, each with faces from 1 to 6, are rolled. The prize for one player is determined as follows.

  1. If all three dice show the same face, the prize is 10,000 + (that face) × 1,000.
  2. If exactly two dice show the same face, the prize is 1,000 + (that face) × 100.
  3. If all three faces are different, the prize is (the largest face) × 100.

N (2 ≤ N ≤ 1,000) players take part. Given the three dice results for each player, output the largest prize.

Input

The first line contains the number of players N. Each of the next N lines contains three dice results for one player, separated by spaces.

Output

Output the largest prize on one line.