Pseudo-equal Numbers
Practice
4 (508 votes)
Dynamic programming
Approved
Easy Medium
Problem
81% Success 3634 Attempts 30 Points 2s Time Limit 128MB Memory 32 KB Max Code

Mike is very much fond of numbers. Two numbers are defined as pseudo-equal if sum of squares of their digits is equal. For example, 143 is pseudo-equal to 51 as 12 + 42 + 32 is equal to 52 + 12.

Now Mike is interested in counting how many ordered pairs (i, j) are there such that 0 ≤ i, j ≤ 10N and i is pseudo-equal to j.

As the answer can be large print it modulo 109 + 7.

Input format

The only line containing N.

Output format

Print in a single line, the required answer modulo 109 + 7.

Constraints

0 ≤ N ≤ 200

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
7 votes
Tags:
AlgorithmsApprovedEasy-MediumDynamic programming
Points:30
50 votes
Tags:
Applications of Dynamic ProgrammingAlgorithmsDynamic Programming
Points:30
3 votes
Tags:
Dynamic ProgrammingAlgorithmsEasy-MediumDynamic programming