Problem: 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 (109 + 7).

Input

A single line contains a single positive integer m (7 ≤ m ≤ 109) — the number of possible numbers in the ballot.

Output

In a single line print a single integer — the answer to the problem modulo 1000000007 (109 + 7).

Examples

Input

7


Output

0


Input

8


Output

1440

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 200005;
const double eps = 1e-7;
const double DINF = 1e100;
const int INF = 1000000006;
const long long LINF = 1000000000000000005ll;
const int MOD = 1000000007;
int m, len;
long long g[20], a[20];
long long f[20][20], F[20][20];
long long fpow(long long a, long long t, long long mod) {
  long long rt = 1;
  for (; t; t >>= 1, a = a * a % mod)
    if (t & 1) rt = rt * a % mod;
  return rt;
}
long long dp(int i, int x) {
  if (x < 0 || x > i) return 0;
  if (f[i][x] != -1) return f[i][x];
  if (i == x) return fpow(2, x, MOD);
  f[i][x] = 8 * dp(i - 1, x) + 2 * dp(i - 1, x - 1);
  return f[i][x];
}
long long calc(int x) {
  long long ans = 0;
  for (int i = len; i >= 1; --i) {
    int t = -1;
    if (a[i] > 7) ans += dp(i - 1, x - 1);
    if (a[i] > 4) ans += dp(i - 1, x - 1);
    if (a[i] > 7)
      t = a[i] - 2;
    else if (a[i] > 4)
      t = a[i] - 1;
    else
      t = a[i];
    ans += t * dp(i - 1, x);
    if (a[i] == 4 || a[i] == 7) --x;
  }
  return ans;
}
long long A(long long x, long long k) {
  if (x < k) return 0;
  long long t = 1;
  for (long long i = x; i > x - k; --i) t = t * i % MOD;
  return t;
}
long long sum[20];
long long b[20];
long long count(int k, long long x) {
  if (k == 6) {
    memset(b, 0, sizeof(b));
    long long tmp = 1;
    for (int i = 0; i < 6; ++i) b[a[i]]++;
    for (int i = 0; i <= 10; ++i) tmp = tmp * A(g[i], b[i]) % MOD;
    return tmp;
  }
  long long rt = 0;
  for (int i = 0; i <= x; ++i) {
    a[k] = i;
    rt += count(k + 1, x - i);
    rt %= MOD;
  }
  return rt;
}
int main() {
  cin >> m;
  ++m;
  for (int t = m; t; t /= 10) a[++len] = t % 10;
  memset(f, -1, sizeof(f));
  dp(1, 1);
  for (int x = 0; x <= 10; ++x) g[x] = calc(x);
  --g[0];
  long long ans = 0;
  for (int x = 1; x <= 10; ++x) {
    ans += g[x] * count(0, x - 1) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}