John in Regina The weather in Regina, Saskatchewan is pretty stable during the month of March. Each day is rainy, snowy or sunny. There is an 80% chance that the weather on one day will be the same as the previous day. When the weather does change, there is a 50/50 chance of what it will be. (For example, if it is rainy on Monday, there is an 80% chance that it will be rainy on Tuesday, a 10% chance that it will by snowy on Tuesday and a 10% chance that it will be sunny on Tuesday.) It snowed on March 1. John lives in Regina. Each day, he plans his activities according to the weather using the probabilities in the following table. sunny day rainy day snowy day work in garden (G) 70% 15% 5% practice ICPC problems (P) 20% 70% 82% shovel snow (S) 0% 0% 5% write angry letters to his M.P. (L) 10% 15% 8% (Notice that the probabilities in each column add up to 100%, so these are the only four activities John does.) John tells you what he did each day in March. You must compute the probability that it is raining on March 31. INPUT ----- The input will consist of several instances. Each instance will consist of a sequence of 31 letters on a single line. Each letter will be either G, P, S or L to indicate which activities John performed on each of the 31 days of March, in order. (The letters used for each activity are given in the table above. For example, G indicates working in the garden.) The end of the input will be indicated by a single Z on a line by itself. OUTPUT ------ For each input instance, output the probability that it was raining on March 31, as a percentage, rounded to the nearest percent. SAMPLE INPUT ------------ GGPGPPGSSGSGGGSPPGPSPPPPPGGPPSS GGPGPPGSSGSGGGSPPGPSPPPPPGGPPSP GPGPGPPSLLLPGPLLGPGPGLPGLPPPGLP Z SAMPLE OUTPUT ------------- 0 9 57