#include <bits/stdc++.h>
using namespace std;
int cnt[11];
int fac[111111], ifac[111111];
int power(int base, long long exponent) {
  int result = 1, m = base;
  while (exponent) {
    if (exponent & 1) result = ((long long)result * m) % 1000000007;
    m = ((long long)m * m) % 1000000007;
    exponent /= 2;
  }
  return result;
}
int c(int n, int k) {
  return (((long long)fac[n] * ifac[k]) % 1000000007 * ifac[n - k]) %
         1000000007;
}
int var(int n, int k) {
  int ans = 1;
  for (int i = 0; i < (k); i++) ans = ((long long)ans * (n - i)) % 1000000007;
  return ans;
}
int main(int argc, char *argv[]) {
  fac[0] = 1;
  for (int i = 0; i < (111111); i++)
    fac[i + 1] = ((long long)fac[i] * (i + 1)) % 1000000007;
  ifac[111111 - 1] = power(fac[111111 - 1], 1000000007 - 2);
  for (int i = (111111 - 2); i >= (0); i--)
    ifac[i] = ((long long)ifac[i + 1] * (i + 1)) % 1000000007;
  int M;
  scanf("%d", &M);
  int m = 1000000000, l = 0;
  for (int step = 0; step < (10); step++) {
    int n = M / m;
    for (int i = 0; i < (n); i++) {
      if (i == 4 || i == 7) l++;
      int rem = 9 - step;
      for (int i = (0); i <= (rem); i++)
        cnt[l + i] = (cnt[l + i] +
                      (long long)c(rem, i) * power(2, i) * power(8, rem - i)) %
                     1000000007;
      if (i == 4 || i == 7) l--;
    }
    if (n == 4 || n == 7) l++;
    M -= n * m;
    m /= 10;
  }
  cnt[0]--;
  cnt[l]++;
  int a[7], _cnt[10];
  int ans = 0;
  for (int first = (1); first <= (9); first++)
    if (cnt[first]) {
      for (a[0] = 0; a[0] < (first); a[0]++)
        for (a[1] = 0; a[1] < (first); a[1]++)
          for (a[2] = 0; a[2] < (first); a[2]++)
            for (a[3] = 0; a[3] < (first); a[3]++)
              for (a[4] = 0; a[4] < (first); a[4]++)
                for (a[5] = 0; a[5] < (first); a[5]++) {
                  int sum = 0;
                  for (int i = 0; i < (6); i++) sum += a[i];
                  if (sum >= first) continue;
                  for (int i = 0; i < (first); i++) _cnt[i] = 0;
                  for (int i = 0; i < (6); i++) _cnt[a[i]]++;
                  bool ok = true;
                  for (int i = 0; i < (first); i++)
                    if (_cnt[i] > cnt[i]) {
                      ok = false;
                      break;
                    }
                  if (!ok) continue;
                  int tmp = 1;
                  for (int i = 0; i < (first); i++)
                    tmp = ((long long)tmp * var(cnt[i], _cnt[i])) % 1000000007;
                  ans = (ans + (long long)cnt[first] * tmp) % 1000000007;
                }
    }
  printf("%d\n", ans);
  return 0;
}
