— Thanks a lot for today.

— I experienced so many great things.

— You gave me memories like dreams... But I have to leave now...

— One last request, can you...

— Help me solve a Codeforces problem?

— ......

— What?

Chtholly has been thinking about a problem for days:

If a number is palindrome and length of its decimal representation without leading zeros is even, we call it a zcy number. A number is palindrome means when written in decimal representation, it contains no leading zeros and reads the same forwards and backwards. For example 12321 and 1221 are palindromes and 123 and 12451 are not. Moreover, 1221 is zcy number and 12321 is not.

Given integers k and p, calculate the sum of the k smallest zcy numbers and output this sum modulo p.

Unfortunately, Willem isn't good at solving this kind of problems, so he asks you for help!

Input

The first line contains two integers k and p (1 ≤ k ≤ 105, 1 ≤ p ≤ 109).

Output

Output single integer — answer to the problem.

Examples

Input

2 100


Output

33


Input

5 30


Output

15

Note

In the first example, the smallest zcy number is 11, and the second smallest zcy number is 22.

In the second example, <image>.

import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;


/**
 * Created by imahmoud on 5/13/17.
 */
public class B {
    static class Writer {
        private OutputStream out;
        public Writer(){
            out = new BufferedOutputStream(System.out);
        }

        public void println() throws IOException {
            out.write('\n');
        }
        public void println(String str) throws IOException {
            this.print(str);
            out.write('\n');
        }
        public void println(char v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(short v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(int v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(long v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(double v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(float v) throws IOException {
            this.print(v);
            out.write('\n');
        }

        public void print(String str) throws IOException {
            out.write(str.getBytes());
        }
        public void print(char v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(short v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(int v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(long v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(double v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(float v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }

        public void flush() throws IOException {
            out.flush();
            out.close();
        }
    }
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
    long re(int n){
        int temp = n;
        long res =0 ;
        int c = 0;
        while (n!=0){
            int m = n % 10;
            res*=10;
            res+=m;
            n /= 10;
            c++;
        }
        res+= Math.pow(10,c) * temp;
        return res;
    }
    public void solve()  throws IOException{
        Scanner in =  new Scanner(System.in);
        Writer out = new Writer();
        int N = in.nextInt();
        int P = in.nextInt();

        long res = 0;

        for (int i = 1; i <= N; i++) {
            long r = re(i);
            res+=r;
        }
        out.print( res % P);
        out.flush();
    }
    public static void main(String[] args) {
        try {
            new B().solve();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
