HZNUOJ

GOV Chronicles - Stupid Version

Tags:
Time Limit:  1 s      Memory Limit:   128 MB
Submission:633     AC:158     Score:88.99

Description

A chilly autumn night. Well wrapped up in a coat, a man is rapidly walking along a gray street. This is the Tradition Keeper of the ACM club in Ural State University. Drizzle and dull sky have always turned him nostalgic. And here we go again, the Tradition Keeper is bringing back the memories of distant past when Ural Federal University wasn't yet existing, and the story of Team.GOV was only starting. Indeed, this story deserves to be preserved for descendants. However, the details are slipping from the Keeper's mind and he seems to need an archive.

4 Turgeneva st. The sixth floor, home Department of Mathematics and Mechanics where the Keeper himself has been studying a long time ago. Long corridors, narrow light bars on the floor, dark corners and eventually an office with ACM archive. The Keeper opened the door and found himself in a cramped room with numerous racks. Dozens of boxes and piles of paper are dumped near the walls. On one box three letters glittered with gold — GOV. The Keeper stepped to the box, drew a heavy file and opened it. On the first page in the right upper corner, there was a photo of a smiling young man with curly hair and a subscript: “Vadik Kantorov, the permanent captain of Team.GOV”.

Right after Vadik had entered University he played a few tricks and got into the half-ready team of Alex and Misha. Alex had been a bright programmer even he was a scholar and so troubled the ACM old-timers. Thus, Alex was ready to name the team: “Alarm”.

So the Vadik's ACM-career began. The team existed during a year. The first battle was the Ural SU Championship where Alarm took only the fifth place and allayed the veterans' fear. Next contest was the ACM ICPC subregional contest. The team played slightly better and took the seventh place out of all teams from the Ural region, and the third out of teams from Ural SU. Alarm became the third freshmen team in the Ural SU history to qualify for the regional contest in St. Petersburg. Unfortunately, in the regional contest, the team scored 86th and broke the record of the lowest position of Ural SU teams. It was a hard hit for the team. The choice had to be made: practice a lot, leave programming contests or keep performing poorly.

Putting back the decision, the team participated in the Ural Championship and scored 19th of all teams and 5th of Ural SU teams. That very moment it became clear that the line-up had to change. However, before the Ural Championship Alarm had applied to the Tatarstan Championship where the team's final battle took place. The team could not even solve a half of the offered problems and did not make in the best ten teams (11th place). On the way back on a train it was decided that Misha had to quit the team.

In the new season, the team needed a new name. Here the preamble is completed and the story of Team.GOV commences. The team consisted of two members having little experience and even less success. A new name was defined — Team.GOV. After long considerations, Vadik figured out that the team missed a strong mathematician. Sasha who had been Vadik's high school friend was picked to fill this role. With Sasha's appearance, everyone felt that everything was going to run smoothly.

The time of Ural SU Championship came, the autumn of 2008, second university year. In unclear circumstances, Sasha has not come to the contest, but even in that case, Team.GOV was second best of Ural SU teams. One-year experience paid off! Sasha did come to the subregional contest but the team reached the only 14th place and did not qualify for the regional contest.

Luckily, Ural SU as the host of the subregional contests has a right to send one extra team to the regional contest. After long negotiations, Team.GOV could make it to the regional contest but with a sudden change in the line-up — Ivan B. came instead of Sasha. The replacement turned out to be fruitful — 76th place (+10 to Alarm's achievement).

But what's said above is totally bullshit, the only thing you need to do is to divide the integer given in input by the number of the occurring times of letter 'e' in the whole description and output the integer part of it. And in order to make it more difficult to find this paragraph, I put some extra text below, please ignore them.

After returning home Ivan B. found another team, thus Team.GOV had to fix the line-up again. Nikita was invited as the third player for the Ural Championship. On the qualification contest Vadik, Nikita, and Alex played very well: the team scored second of Ural SU teams. Truly an astounding success!

Being very enthusiastic Vadik and Nikita came to the Ural Championship. For some strange reason, Alex did not come. The team performed very poorly yet another time — 25th place of all teams and 5th of Ural SU teams. Nikita was not satisfied with such attitude and Team.GOV became only two players again — Alex and Vadik. What a curse! The team started to search for the third player.

And the next season came — it's been two years since Vadik entered Ural SU. The search for the third teammate was completed successfully. Senior student Fedor was very experienced and had been practicing since 9th grade of high school. Bright future was ahead of the team. The curse was over and Team.GOV played three official contests with the same line-up. The team scored 12th in the subregional contest, safely advanced to the regional, and then took the third place on the Ural SU Championship.

The regional contest in St. Petersburg yielded a diploma and the 61st place, which was +15 to the previous year's position.

Having returned from St. Petersburg, Team.GOV participated in a unique competition of ACM ICPC veterans and current teams — Battle of Generations. Sadly, Alex couldn't come but team figured it out — Ivan K. came to the rescue and replaced Alex.

Alex wasn't keeping fit: no practice, light attitude to contests — Vadik began to look for a replacement. Nikita accepted the invitation cheerfully once he heard of Alex quitting the team. The first contest after his return to Team.GOV was a qualification for the Ural Championship. Suddenly Vadik had some urgent business in Europe, so Fedor and Nikita participated without him. They performed quite well and solved as many problems as the leaders did. As a result, the team got the third place and qualified for the Ural Championship.

The Ural Championship brought a new grief: 25th place out of all teams, and 4th out of Ural SU teams. Fedor and Nikita couldn't hold the nerves, and Vadik had to look for new teammates all over again.

The fourth and the last year of university. Vadik wanted to put an end to his ACM-career and he needed a new team. The veterans recommended taking young and promising Den. Vadik conducted a little test, and Den was taken. Only a few days were left before the Ural SU Championship, almost all the teams were formed, while Vadik was still answering his eternal question — where to get the third team member? Accidentally he found that Egor was looking for a new team after his previous team broke apart. A new line-up of Team.GOV was born.

On the Ural SU Championship Team.GOV failed again and got an only 5th place. The subregional contest wasn't successful as well — 9th place out of all teams and 4th out of Ural SU teams. Ural SU got an extended quota and Team.GOV was going to St. Petersburg again.

Before St. Petersburg Team.GOV needed a serious practice session. All-Siberian Olympiad was a perfect shot. Team.GOV went to Novosibirsk and discovered again how weak they were: 39th place out of all teams and the worst performance out of Ural SU teams. So the guys set out to St. Petersburg with great leisure plans. Well, taking part counts no less than victory!

On the regional contest, surprisingly for the coaches, Team.GOV scored five problems in the first four hours and was quite high ranked. After the contest, the coaches discovered that the team scored not only the sixth problem but also a seventh one. The result — 26th place (+35 to the last year's position) and a second grade diploma. Team.GOV finally reached success and glory. The road back home was ahead.

The spring, Team.GOV traditionally broke up. Vadik wanted to do something fancy, it was his last contest after all. Vadikinvites his Chinese girlfriend Xiaohong. The third invited teammate, unfortunately, didn't come, so in the last minute, Vadik took Vitaliy (medal winner of ACM ICPC World Finals) for the Game Tournament before the Ural Championship. Unfortunately, Vitaliy could not participate in the main contest, so Vadik took Sasha as an old friend. This was the last contest of Team.GOV.

The Tradition Keeper scratched his head: in how many Alarm / Team.GOV contests has every team member participated? Vadik had always told that Misha is the member number zero because he had played in Team.GOV before the team got its name. Vadik is indeed player number one.

There's a tricky case with Vitaliy: of course, he hasn't taken part in any Team.GOV contest, Game Tournament shouldn't be counted. But he definitely deserves to be included in the history of Team.GOV, because he is an award winner of World Finals and a valuable player in general.

The Tradition Keeper meticulously listed all the members of Team.GOV. (Misha — 0, Vadik — 1, Alex — 2, Sasha — 3, Ivan B. — 4, Nikita — 5, Fedor — 6, Ivan K. — 7, Den — 8, Egor — 9, Xiaohong — 10, Vitaliy — 11). He counted that a number zero has played for 5 times (because exactly 5 contests were played by Alarm). And a number one participated in 20 contests.


Input

Firstly is a integer T(0<T<=500), then T lines follow.

Each line contains an integer n(0<n<10^9).

Output

Output the answer mentioned in the description.

Samples

input
1 3
output
0
input
1 4
output
0
input
4 5 9 2 6
output
0 0 0 0

Hint

Read it with inner peace.

Life is a box of chocolate, you don‘t know what you are gonna get. 

Author

WEI, Lixin

Source

杭州师范大学第十届程序设计竞赛