Fişierul intrare/ieşire:dream.in, dream.outSursăIIOT 2022-23 Runda 1
AutorDaniel ApostolAdăugată destefdascalescuStefan Dascalescu stefdascalescu
Timp execuţie pe test0.5 secLimită de memorie16384 kbytes
Scorul tăuN/ADificultateN/A

Vezi solutiile trimise | Statistici

Dream

Old Man Ivan, a hard working farmer, tired after a long day of beating the fields, he decided to go to bed.

Being a religious man, he was visited at night by Apostle in a dream. He promised Ivan that his next harvest will be rich, if the farmer is able to help him out with a problem that had been bothering the poor Apostle for a long time.

"Given K and K, natural numbers, and X is even, find out the sum of the first K palindromes with X digits".

Because Apostle knows that Old Man Ivan is a mere mortal, he only wants the remainder of this sum when divided by 666013.

Help Ivan solve the problem.

Date de intrare

The only line of the input file dream.in consists of two integers, K and X.

Date de ieşire

The output file dream.out will contain the answer requested by the Apostle.

Restricţii

  • 1 ≤ K, X ≤ 10^5
  • For tests worth 15 points, X ≤ 8.
  • For tests worth 20 more points, X ≤ 18.
  • For tests worth 35 more points, X * K ≤ 10^5.

Exemplu

dream.indream.out
3 4
3333

Explicaţie

The first 3 palindromes with 4 digits are 1001, 1111, 1221. The sum will be 1001 + 1111 + 1221 = 3333.

Trebuie sa te autentifici pentru a trimite solutii. Click aici

Cum se trimit solutii?