301377: CF258B. Little Elephant and Elections

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Little Elephant and Elections

题意翻译

有七个人,每个人可以在 $[1,m]$ 中选择一个数,但注意每个人选择的数不应该相同。定义一个人的幸运指数是他选择的数十进制按位拆分之后 $4$ 和 $7$ 的个数,希望求出第一个人的幸运指数比其他人总和还大的方案数。对 $10^9+7$ 取模。

题目描述

There have recently been elections in the zoo. Overall there were $ 7 $ main political parties: one of them is the Little Elephant Political Party, $ 6 $ other parties have less catchy names. Political parties find their number in the ballot highly important. Overall there are $ m $ possible numbers: $ 1,2,...,m $ . Each of these $ 7 $ parties is going to be assigned in some way to exactly one number, at that, two distinct parties cannot receive the same number. The Little Elephant Political Party members believe in the lucky digits $ 4 $ and $ 7 $ . They want to evaluate their chances in the elections. For that, they need to find out, how many correct assignments are there, such that the number of lucky digits in the Little Elephant Political Party ballot number is strictly larger than the total number of lucky digits in the ballot numbers of 6 other parties. Help the Little Elephant Political Party, calculate this number. As the answer can be rather large, print the remainder from dividing it by $ 1000000007 $ $ (10^{9}+7) $ .

输入输出格式

输入格式


A single line contains a single positive integer $ m $ $ (7<=m<=10^{9}) $ — the number of possible numbers in the ballot.

输出格式


In a single line print a single integer — the answer to the problem modulo $ 1000000007 $ $ (10^{9}+7) $ .

输入输出样例

输入样例 #1

7

输出样例 #1

0

输入样例 #2

8

输出样例 #2

1440

Input

题意翻译

有七个人,每个人可以在 $[1,m]$ 中选择一个数,但注意每个人选择的数不应该相同。定义一个人的幸运指数是他选择的数十进制按位拆分之后 $4$ 和 $7$ 的个数,希望求出第一个人的幸运指数比其他人总和还大的方案数。对 $10^9+7$ 取模。

加入题单

算法标签: