Dream

Time limit: 1s
Memory limit: 256MB
Input:
Output:

Task

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 KK and XX, natural numbers, and XX is even, find out the sum of the first KK palindromes with XX digits".

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

Help Ivan solve the problem.

Input

The only line of the input consists of two integers, KK and XX.

Output

The output will contain the answer requested by the Apostle.

Restrictions

  • 1K,X1051 \leq K, X \leq 10^5
  • For tests worth 1515 points, X8X \le 8.
  • For tests worth 2020 more points, X18X \le 18.
  • For tests worth 3535 more points, XK105X \cdot K \leq 10^5.

Example

stdin

3 4

stdout

3333

Explanation

The first 33 palindromes with 44 digits are 1001,1111,12211001, 1111, 1221. The sum will be 1001+1111+1221=33331001 + 1111 + 1221 = 3333.

Problem info

ID: 300

Editor: Dap

Author:

Source: IIOT 2022-23 Round I

Tags:

IIOT 2022-23 Round I

Log in or sign up to be able to send submissions!