题库练习 Palindrome Basis
← 上一题 下一题 →

A14990 | Palindrome Basis

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given a positive integer $n$ . Let's call some positive integer $a$ without leading zeroes palindromic if it remains the same after reversing the order of its digits. Find the number of distinct ways to express $n$ as a sum of positive palindromic integers. Two ways are considered different if the frequency of at least one palindromic integer is different in them. For example, $5=4+1$ and $5=3+1+1$ are considered different but $5=3+1+1$ and $5=1+3+1$ are considered the same.

Formally, you need to find the number of distinct multisets of positive palindromic integers the sum of which is equal to $n$ .

Since the answer can be quite large, print it modulo $10^9+7$ .

输入格式

The first line of input contains a single integer $t$ ( $1\leq t\leq 10^4$ ) denoting the number of testcases.

Each testcase contains a single line of input containing a single integer $n$ ( $1\leq n\leq 4\cdot 10^4$ ) — the required sum of palindromic integers.

输出格式

For each testcase, print a single integer denoting the required answer modulo $10^9+7$ .

输入输出样例

输入 #1
2
5
12
输出 #1
7
74
C++ 编辑器
输入
输出