ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1971. Graphics Settings

Time limit: 2.0 second
Memory limit: 64 MB
‘Do you know what a gamer does first when he starts a new game?’
‘Starts training?’
‘No. He goes to the graphics settings and sets everything to maximum. Only after that he starts the training and realizes that it works too slowly. So he goes to the settings once again, turns half of the options off, returns to the training, and so on until he has found suitable parameters. Or until he’s tired—then he quits the game and deletes it, which we don’t want to happen.’
‘What do you suggest?’
‘Look. When all the graphics enhancements are turned off, a frame with resolution w × h pixels is generated in w · h GPU cycles. We know the factors by which the generation is slowed down when a certain option is turned on. So we can calculate the number of GPU cycles in which a frame is generated for a given set of options. Dividing the clock rate of the GPU by this number, we obtain the number of frames per second. If it is too small or too large, we will write about it in the graphics settings.’

Input

The first line contains the number of graphics options n (0 ≤ n ≤ 100 000). In the i-th of the following n lines you are given a word si, which is the name of the i-th option, and an integer ki (2 ≤ ki ≤ 100), which is the factor by which the image generation is slowed down when this option is switched on. The names of the options contain only lowercase English letters, and their lengths are from 1 to 10. The next line contains integers W, H, and p separated with a space (320 ≤ W ≤ 2 560; 200 ≤ H ≤ 1 600; 1 ≤ p ≤ 109). They are the initial width and height of the screen in pixels and the clock rate of the GPU in cycles per second. At the beginning all the options are turned on. In the following line you are given the total number m (1 ≤ m ≤ 100 000) of the changes in the option settings made by the user. Each of the following m lines has one of the formats:
  • “On s” — switch on the option with name s;
  • “Off s” — switch off the option with name s;
  • “Resolution w h” — set the screen resolution to w × h pixels (320 ≤ w ≤ 2 560; 200 ≤ h ≤ 1 600).
It is guaranteed that an option s has been turned off when the change “On s” is applied and turned on when the change “Off s” is applied.

Output

The first line should describe the performance of the game before changes in the settings. Then next m lines should describe the performance of the game after each change in the settings. Output “Slideshow” if the image generation speed is less than 10 frames per second, “Perfect” if it is 60 frames per second or greater, and “So-so” otherwise.

Sample

inputoutput
1
vsync 10
640 480 10000000
2
Off vsync
Resolution 320 240
Slideshow
So-so
Perfect
Problem Author: Denis Dublennykh
Problem Source: Ural Sport Programming Championship 2013