ADST01 - Truncky Numbers

Asutosh is very passionate about numbers. he has found a new type of numbers and calls them 'truncky numbers'.

He has challenged his friend Shantanu to find the sum of first n truncky numbers. As shantanu is weak at programming, help him to complete his challenge.

A truncky number is defined as:

  1. sum of digits in the number is of the form (5*k + 1) where k = number of digits.
  2. absolute difference between any two digits in the number is either 0 or 1.
  3. digits are in the non decreasing order.

Input

the first line contains T (number of test cases). Each test contains only one integer n.

Output

Print in single line sum of first n truncky numbers modulo 10^9 + 7.

Each output in new line.

Constraints

T <= 30

N <= 10^17

Example

Input:
1
2

Output:
62

Added by:Voldemort
Date:2015-09-12
Time limit:0.100s-1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: GOSU
Resource:own

hide comments
2016-06-22 21:12:00
my love for python grows more!! simple math formula :) AC !
2016-01-11 11:14:13
nice question @Ashutosh....
2016-01-03 12:02:40 Diksha Jaiswal
good problem
2015-10-16 08:31:39
Great question!

Last edit: 2015-10-16 08:31:56
2015-10-05 19:33:34 Daksh
12 class math..
2015-09-17 18:14:15
nice question bhai..!!
2015-09-17 07:41:06 Advitiya
Silly Mistakes 3WA, finally AC :')
2015-09-17 06:42:56
what is answer for 10000000000
pls give some hint

Last edit: 2015-09-17 08:08:12
2015-09-16 17:51:51 Anshul jain
after many WA finally the code got accepted!!!


Last edit: 2015-09-16 18:05:17
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.