#include <bits/stdc++.h>
using namespace std;
long long cnt[10] = {0};
vector<int> lmt;
long long dp[12][12][2];
int isLucky(int i) {
  if (i == 4 or i == 7)
    return 1;
  else
    return 0;
}
long long solve(int idx, int left, int tight) {
  if (idx == (int)lmt.size())
    return (left == 0);
  else if (dp[idx][left][tight] != -1)
    return dp[idx][left][tight];
  long long ret = 0;
  if (tight) {
    for (int i = 0; i < lmt[idx]; i++)
      ret += solve(idx + 1, left - isLucky(i), 0);
    ret += solve(idx + 1, left - isLucky(lmt[idx]), 1);
  } else {
    for (int i = 0; i < 10; i++) ret += solve(idx + 1, left - isLucky(i), 0);
  }
  return (dp[idx][left][tight] = ret);
}
long long F(int l) {
  for (int i = (int)(0); i < (int)(12); i++)
    for (int j = (int)(0); j < (int)(12); j++)
      for (int k = (int)(0); k < (int)(2); k++) dp[i][j][k] = -1;
  return solve(0, l, 1);
}
int main() {
  int n;
  cin >> n;
  while (n) {
    lmt.push_back(n % 10);
    n /= 10;
  }
  reverse(lmt.begin(), lmt.end());
  for (int i = 0; i < 10; i++) cnt[i] = F(i);
  long long ans = 0;
  cnt[0] -= 1;
  for (int i = 0; i < 9; i++) {
    long long A = cnt[i];
    cnt[i] -= 1;
    for (int j = 0; (i + j) < 9; j++) {
      long long B = cnt[j];
      cnt[j] -= 1;
      for (int k = 0; (i + j + k) < 9; k++) {
        long long C = cnt[k];
        cnt[k] -= 1;
        for (int l = 0; (i + j + k + l) < 9; l++) {
          long long D = cnt[l];
          cnt[l] -= 1;
          for (int m = 0; (i + j + k + l + m) < 9; m++) {
            long long E = cnt[m];
            cnt[m] -= 1;
            for (int n = 0; (i + j + k + l + m + n) < 9; n++) {
              if (i + j + k + l + m + n >= 9) break;
              long long F = cnt[n];
              cnt[n] -= 1;
              long long me = 0;
              int s = i + j + k + l + m + n + 1;
              for (; s < 10; s++) me += cnt[s];
              me = (me * F) % 1000000007;
              me = (me * D) % 1000000007;
              me = (me * B) % 1000000007;
              me = (me * E) % 1000000007;
              me = (me * C) % 1000000007;
              me = (me * A) % 1000000007;
              ans = (ans + me) % 1000000007;
              cnt[n] += 1;
            }
            cnt[m] += 1;
          }
          cnt[l] += 1;
        }
        cnt[k] += 1;
      }
      cnt[j] += 1;
    }
    cnt[i] += 1;
  }
  cout << ans << endl;
  return 0;
}
