#include <bits/stdc++.h>
using namespace std;
const int size = 900000, mod = 1000000007, inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int nex[2][4] = {0, 1, 0, -1, 1, 0, -1, 0};
int f[12][12][2];
bool vis[12][12][2];
vector<int> ar;
int dfs(int pos, int num, bool flag) {
  if (pos == ar.size()) {
    if (num == 0)
      return 1;
    else
      return 0;
  }
  if (vis[pos][num][flag]) return f[pos][num][flag];
  for (int i = 0; i <= (flag ? ar[pos] : 9); i++)
    f[pos][num][flag] +=
        dfs(pos + 1, num - (i == 4 || i == 7), flag && i == ar[pos]);
  vis[pos][num][flag] = 1;
  return f[pos][num][flag];
}
int cal(int x) { return dfs(0, x, 1) - (x == 0); }
int numb[12];
long long ans;
void de(int x, int num, long long w) {
  if (num == 6) {
    ans = (ans + w) % mod;
    return;
  }
  for (int i = 0; i <= x; i++) {
    if (cal(i) - numb[i] >= 1) {
      de(x - i, num + 1, (w * (cal(i) - numb[i]++)) % mod);
      numb[i]--;
    }
  }
}
int main() {
  int n;
  long long re = 0;
  cin >> n;
  int tmp = n;
  while (tmp) {
    ar.push_back(tmp % 10);
    tmp /= 10;
  }
  reverse(ar.begin(), ar.end());
  for (int i = 1; i < 10; i++) {
    if (cal(i) == 0) break;
    ans = 0;
    de(i - 1, 0, 1);
    re = (re + cal(i) * ans % mod) % mod;
  }
  cout << re << endl;
  return 0;
}
