| 
 
 
| Feedback |  | If you notice incorrect translations in Contester, please let author know. |  
 | Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
 
 
   Secret NumberAgent Genti has brought you a secret message. 
You have to decode the message and find the number 
(a telephone number or any secret number that you need) 
in it. You know the secret function:  a[x-1] = b * a[x+1] - cwhere b and c are the numbers 
given. And the secret message will be sent 
later. The message 
is a series of numbers and the message is hidden 
on the positions comply the given function. 
You need to take the last digit of these numbers 
(a[x]) to form the new number. 
Then, you multiply the number with k to get 
the secret number. Note:
: The number might have at most seven 
digits, so, if there are more than 7 digits, 
take the first 7 digits. Input specification  You are firstly given 4 numbers: The number of numbers 
(n) and the numbers b, c and k. Then in the following 
n lines, you will be given n numbers where each of the 
number is between
 -3e4and3e4, 
1 ≤ n ≤ 40,000 and0 ≤ (b, c and k) ≤ 20. Output specification: Show the secret number.
 
  
| Sample Input I 
 
10 2 9 337
 7
 23
 8
 13
 15
 -16
 12
 13
 42
 
 | Sample Input II 
 
10 3 5 379
 88
 55
 31
 28
 78
 11
 64
 83
 23
 
 |  
| Sample Output I 
 
2208
 | Sample Output II 
 
1749
 |  Explanation: 
 
Then the numbera[0] = 37, a[1] = 7, a[2] = 23, b = 2 
and c = 9 . And because37 = 
2 * 23 - 9, the first number is7and its 
last digit is 7.Because 7 = 2*8 - 9 , the second 
number is23:(and its last digit3is 
taken)Lastly 15 = 2 * 12 - 9, so, the third number 
is-16. And, its last digit6is 
taken. 736is formed. In order to 
find the searching number this number is 
multiplied with k and we have the secret message:2208.
 Для отправки решений необходимо выполнить вход.
 
 
 |