#include <bits/stdc++.h>
using namespace std;
inline int ADD(int a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
  return (int)a;
}
inline void ADDTO(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
inline void SUBTO(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
inline int MUL(int a, int b) { return (int)((long long)a * b % 1000000007); }
int dp[15][15][2], cnt[15], pick[15], n, ans;
char s[15];
void dfs(int dep, int sum) {
  if (dep == 6) {
    int way = 0;
    for (int s = (sum + 1); s <= (n); ++s) ADDTO(way, cnt[s]);
    for (int i = 0; i < (n); ++i)
      if (pick[i]) {
        for (int j = 0; j < (pick[i]); ++j) way = MUL(way, cnt[i] - j);
      }
    ADDTO(ans, way);
    return;
  }
  for (int i = (0); i <= (n - sum - 1); ++i)
    if (pick[i] < cnt[i]) {
      ++pick[i];
      dfs(dep + 1, sum + i);
      --pick[i];
    }
}
int main() {
  while (cin >> s) {
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    n = strlen(s);
    for (int i = 0; i < (n); ++i)
      for (int j = (0); j <= (i); ++j)
        for (int d = 0; d < (10); ++d) {
          int w = (d == 4 || d == 7);
          dp[i + 1][j + w][1] += dp[i][j][1];
          if (d < s[i] - '0') dp[i + 1][j + w][1] += dp[i][j][0];
          if (d == s[i] - '0') dp[i + 1][j + w][0] += dp[i][j][0];
        }
    for (int j = (0); j <= (n); ++j) cnt[j] = dp[n][j][0] + dp[n][j][1];
    --cnt[0];
    if (cnt[n] == 0) --n;
    ans = 0;
    memset(pick, 0, sizeof(pick));
    dfs(0, 0);
    printf("%d\n", ans);
  }
}
