— 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.util.*;

public class Main {

    static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {

        int n = in.nextInt();
        int p = in.nextInt();
        String [] dp = new String[n];
        int step = 1;
        long result = 0;
        for (int i = 0; i < dp.length; i++) {
            String first = Integer.toString(step);
            String second = reverseTheString(first);
            dp[i] = first + second;
            step++;
            result+=Long.parseLong(dp[i])%p;
        }
        System.out.println(result%p);
    }
    private static String reverseTheString(String s) {
        char [] c = s.toCharArray();
        int i = 0;
        int j = c.length - 1;
        while (i<j) {
            char temp = c[i];
            c[i] = c[j];
            c[j] = temp;
            i++;
            j--;
        }
        return new String(c);
    }
    private static int[] prefixSum(int [] a) {
        int [] prefix = new int[a.length+1];
        for (int i = 0; i < a.length; i++) {
            prefix[i+1] = prefix[i] + a[i];
        }
        return prefix;
    }
    private static int solve(int d, String s)  {
        char [] c = s.toCharArray();
        int dam = damage(c);
        int count = 0;
        while(dam > d) {
            swap(c);
            dam = damage(c);
            count++;
        }
        return count;
    }
    private static void swap(char [] c) {
        for(int i=c.length - 1;i>=1;i--) {
            if(c[i]=='S' && c[i-1]=='C') {
                char temp = c[i];
                c[i] = c[i-1];
                c[i-1] = temp;
                break;
            }
        }
    }
    private static boolean checkForImpossible(int d,String  s) {
        char [] c = s.toCharArray();
        Arrays.sort(c);
        int sum = 0;
        for (int i = c.length - 1;i>=0;i--) {
            if(c[i] == 'C') break;
            sum++;
        }
        return sum > d;

    }
    private static int damage(char [] c) {
        int p = 1;
        int s = 0;

        for(int i=0;i<c.length;i++) {
            if(c[i] == 'C') {
                p*=2;
            }
            if(c[i] == 'S') {
                s+=p;
            }
        }
        return s;
    }
    private static int numberOfNineTeens(int [] mainFreq, int [] nineteenFreq) {
        int count = Integer.MAX_VALUE;
        for (int i = 0; i < mainFreq.length; i++) {
            if(nineteenFreq[i]>0) {
                if(mainFreq[i] < nineteenFreq[i]) return 0;
                else {
                    System.out.println((char)(i+'a') + " " + mainFreq[i] + " " + nineteenFreq[i]);
                    int temp = mainFreq[i]/nineteenFreq[i];
                    if(i+'a' == 'n') temp+=1;
                    count = Math.min(count,temp);
                }
            }
        }
        return count;
    }
    private static int [] frequency(String s) {
        int [] freq = new int[26];
        for(char c : s.toCharArray()) {
            freq[c-'a']++;
        }
        return freq;
    }
    private static List<Integer> partitionSubSequence(String [] a) {
        LinkedHashMap<String,FirstLastIndex> map = new LinkedHashMap<>();
        for (int i = 0; i < a.length; i++) {
            if(!map.containsKey(a[i])) {
                map.put(a[i],new FirstLastIndex(i+1,i+1));
            }
            else {
                FirstLastIndex index = map.get(a[i]);
                index.setLastIndex(i+1);
                map.put(a[i],index);
            }
        }
        List<Integer> result = new ArrayList<>();
        int max = 1;
        int previousMax = 0;
        int sum = 0;
        for (Map.Entry<String,FirstLastIndex> m : map.entrySet()) {
            if(max < m.getValue().getFirstIndex()) {
                sum+=max-previousMax;
                result.add(max-previousMax);
                previousMax = max;
                max = m.getValue().getLastIndex();
            }
            max = Math.max(max,m.getValue().getLastIndex());
        }
        result.add(a.length - sum);
        return result;
    }
    static int [] readAnArray(int n) {
        int [] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        return a;
    }
}
class FirstLastIndex {
    private int firstIndex;
    private int lastIndex;

    public int getFirstIndex() {
        return firstIndex;
    }

    public int getLastIndex() {
        return lastIndex;
    }

    public void setFirstIndex(int firstIndex) {
        this.firstIndex = firstIndex;
    }

    public void setLastIndex(int lastIndex) {
        this.lastIndex = lastIndex;
    }

    public FirstLastIndex(int firstIndex, int lastIndex) {
        this.firstIndex = firstIndex;
        this.lastIndex = lastIndex;
    }
}
class Person {

    private int height;
    private int front;

    public int getHeight() {
        return height;
    }
    public int getFront() {
        return front;
    }

    public Person(int height, int front) {
        this.height = height;
        this.front = front;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return height == person.height &&
                front == person.front;
    }

    @Override
    public int hashCode() {
        return Objects.hash(height, front);
    }
}