#include <bits/stdc++.h>
int dr[] = {2, 2, -2, -2, 1, -1, 1, -1};
int dc[] = {1, -1, 1, -1, 2, 2, -2, -2};
int dr1[] = {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
int dr2[] = {0, 0, 1, -1};
int dc2[] = {1, -1, 0, 0};
using namespace std;
long long int dp[12][2][12];
long long int a[20];
string t;
long long int cal(long long int x, long long int f, long long int y) {
  if (y < 0) return 0;
  if (x == t.size()) {
    if (y == 0) return 1;
    return 0;
  }
  long long int &r = dp[x][f][y];
  if (r != -1) return r;
  r = 0;
  long long int u = 9;
  if (f == 0) u = t[x] - '0';
  for (long long int i = 0; i <= u; i++) {
    r += cal(x + 1, i < u || f == 1, y - (i == 4 || i == 7));
  }
  return r;
}
long long int cal1(long long int x, long long int s) {
  if (s > 9) return 0;
  if (x == 0) {
    long long int s1 = 0;
    for (long long int i = s + 1; i <= 10; i++) s1 += a[i];
    s1 %= 1000000007;
    return s1;
  }
  long long int r = 0;
  for (long long int i = 0; i <= 10; i++) {
    long long int p = a[i];
    a[i]--;
    r = r + p * cal1(x - 1, s + i);
    r %= 1000000007;
    a[i]++;
  }
  return r;
}
int main() {
  long long int i;
  while (cin >> t) {
    for (i = 0; i <= 10; i++) {
      memset(dp, -1, sizeof(dp));
      a[i] = cal(0, 0, i);
      long long int cn = 0;
      if (i == 0) a[i]--;
    }
    long long int ans = cal1(6, 0);
    cout << ans << endl;
  }
  return 0;
}
