#include <bits/stdc++.h>
using namespace std;
const int MODULE = (int)1e9 + 7;
int m = 0;
int F[222][222];
int G[22][22];
int TC[22];
int len = 0;
int powmod(int x, int k) {
  int ans = 1;
  while (k) {
    if (k & 1) ans = (unsigned long long)ans * x % MODULE;
    x = (unsigned long long)x * x % MODULE;
    k >>= 1;
  }
  return ans;
}
unsigned long long C(int n, int m) {
  unsigned long long ans = 1;
  for (int i = 0; i < m; i++)
    ans = ans * (n - i) % MODULE * powmod(i + 1, MODULE - 2) % MODULE;
  return ans;
}
int spl[22] = {0};
int dfs(int rem, int lucky, bool highest) {
  if (!highest && G[rem][lucky] != -1) return G[rem][lucky];
  if (rem == 0) return lucky == 0;
  int ans = 0;
  int limit = spl[rem - 1];
  if (!highest) limit = 9;
  for (int i = 0; i <= limit; i++) {
    if (i == 4 || i == 7) {
      if (lucky) ans += dfs(rem - 1, lucky - 1, highest && i == spl[rem - 1]);
    } else
      ans += dfs(rem - 1, lucky, highest && i == spl[rem - 1]);
  }
  if (!highest) G[rem][lucky] = ans;
  return ans;
}
int main() {
  scanf("%d", &m);
  while (m) {
    spl[len++] = m % 10;
    m /= 10;
  }
  memset(G, -1, sizeof(G));
  for (int i = 0; i < 11; i++) TC[i] = dfs(len, i, true);
  TC[0]--;
  F[0][0] = 1;
  for (int i = 0; i < 11; i++) {
    for (int j = 80; j >= 0; j--) {
      for (int k = 5; k >= 0; k--) {
        if (F[j][k]) {
          for (int t = 1; t + k <= 6; t++) {
            F[j + i * t][k + t] =
                (F[j + i * t][k + t] +
                 (unsigned long long)F[j][k] * C(TC[i], t) % MODULE) %
                MODULE;
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= 9; i++) {
    for (int j = i + 1; j <= 9; j++) {
      ans += (unsigned long long)TC[j] * F[i][6] % MODULE;
      ans %= MODULE;
    }
  }
  ans = (unsigned long long)ans * 720 % MODULE;
  printf("%d\n", ans);
  while (getchar() != EOF)
    ;
  return 0;
}
