#863
Silver IV
LIGA
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

While the players are resting between sets, the station puts on tedious commercials. Zvonko fires up the teletext feature on his TV set and is reviewing the latest scores and standings in the football league. Always sharp, he has come up with a new mathematical game.

The standings table contains five statistics for each team: the total number of games played, how many of those games the team won, drew and lost, and points earned. A team earns 3 points for every win and 1 point for every draw.

Zvonko noticed that the values of some fields can be determined from the others.

Write a program that takes in a table in which the values of some fields are unknown, and fills in the missing fields.

The data for different teams is not related. For example, it is possible that the table says all teams have won all their games (although that is not possible in a real league).

Each team will have played at most 100 games (even though that can be one of the missing fields).

입력

The first line contains an integer NN (1N10001 \le N \le 1000), the number of teams in the league.

Each of the following NN lines contains the 5 fields for one team separated by single spaces, containing the 5 pieces of data as described in the problem statement. Each field contains an integer (at least 0), or the character '?' (question mark) if the value is not known.

The input will be consistent and there will be a unique way to determine the values of the missing fields.

출력

Output the table with the missing fields filled in.

예제 입력 1

5
27 21 3 3 66
27 18 6 3 ?
? 15 5 7 50
? 14 7 5 ?
? 14 ? 8 47

예제 출력 1

27 21 3 3 66
27 18 6 3 60
27 15 5 7 50
26 14 7 5 49
27 14 5 8 47
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver IV1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.