#include <bits/stdc++.h>
using namespace std;
long long calcNumber(int, int, int);
long long dp(int, int, int);
long long comb(long long, long long);
long long MEMO[12][12][2];
long long C[12];
long long memo[12][12][12];
long long F[10];
int S[12];
int L;
int main() {
  memset(MEMO, -1, sizeof MEMO);
  memset(memo, -1, sizeof memo);
  memset(C, 0, sizeof C);
  F[0] = 1LL;
  for (int i = 1; i < 10; i++) F[i] = (F[i - 1] * i) % 1000000007LL;
  string linea;
  cin >> linea;
  L = linea.size();
  for (int i = 0; i < L; i++) S[i] = linea[i] - '0';
  for (int i = 0; i < 11; i++) {
    C[i] = calcNumber(i, 0, true);
  }
  C[0]--;
  long long ans = 0LL;
  for (int s = 1; s < 11; s++)
    ans = (ans + dp(0, 6, s - 1) * C[s]) % 1000000007LL;
  cout << ans << endl;
  return 0;
}
long long calcNumber(int x, int l, int e) {
  long long &ret = MEMO[x][l][e];
  if (ret != -1LL) return ret;
  if (l == L) {
    if (x == 0) return ret = 1LL;
    return ret = 0LL;
  }
  ret = 0;
  if (e) {
    for (int k = 0; k <= S[l]; k++) {
      if (k == 4 or k == 7) {
        if (x) ret += calcNumber(x - 1, l + 1, k == S[l]);
      } else
        ret += calcNumber(x, l + 1, k == S[l]);
    }
  } else {
    for (int k = 0; k <= 9; k++) {
      if (k == 4 or k == 7) {
        if (x) ret += calcNumber(x - 1, l + 1, false);
      } else
        ret += calcNumber(x, l + 1, false);
    }
  }
  return ret;
}
long long dp(int p, int x, int sum) {
  long long &ret = memo[p][x][sum];
  if (ret != -1LL) return ret;
  if (p == 11) {
    if (x == 0) {
      return ret = 1LL;
    } else {
      return ret = 0LL;
    }
  }
  ret = 0LL;
  int limite;
  if (p == 0) {
    limite = min((long long)x, C[p]);
  } else {
    limite = min((long long)min(x, sum / p), C[p]);
  }
  for (int y = 0; y <= limite; y++) {
    long long tmp = 1LL;
    for (int i = 0; i < y; i++) tmp = (tmp * (C[p] - i)) % 1000000007LL;
    ret = (ret +
           ((comb(x, y) * tmp) % 1000000007LL * dp(p + 1, x - y, sum - y * p)) %
               1000000007LL) %
          1000000007LL;
  }
  return ret;
}
long long comb(long long n, long long x) {
  if (n == 0LL) return 1LL;
  if (x == 0LL) return 1LL;
  if (n == x) return 1LL;
  long long ans = 1;
  for (long long y = 1LL; y <= x; y++) {
    ans = ((ans * (n - y + 1LL)) / (y)) % 1000000007LL;
  }
  return ans;
}
