#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > getMasks(string pattern) {
  vector<vector<pair<int, int> > > results;
  for (int j = ((int)pattern.size()) - 1; j >= 0; j--) {
    vector<pair<int, int> > curpat;
    bool flag = false;
    for (int k = 0; k < j; k++) {
      int dig = pattern[k] - '0';
      curpat.push_back(pair<int, int>(dig, dig));
    }
    if (pattern[j] == '0') {
      flag = true;
      continue;
    }
    int dig = pattern[j] - '1';
    curpat.push_back(pair<int, int>(0, dig));
    for (int k = j + 1; k < ((int)pattern.size()); k++)
      curpat.push_back(pair<int, int>(0, 9));
    if (curpat[0].first == 0 && curpat[0].second == 0)
      curpat.erase(curpat.begin());
    bool flag2 = true;
    results.push_back(curpat);
  }
  vector<pair<int, int> > curpat;
  for (int i = 0; i < ((int)pattern.size()); i++) {
    int dig = pattern[i] - '0';
    curpat.push_back(pair<int, int>(dig, dig));
  }
  results.push_back(curpat);
  return results;
}
long long countways(vector<pair<int, int> > &pat, int pos, int luckleft) {
  if (pos == ((int)pat.size()) && luckleft == 0)
    return 1LL;
  else if (pos == ((int)pat.size()))
    return 0LL;
  long long digs = (long long)pat[pos].second - pat[pos].first + 1;
  long long ldigs = 0LL;
  if (pat[pos].first <= 4 && pat[pos].second >= 4) ldigs++;
  if (pat[pos].first <= 7 && pat[pos].second >= 7) ldigs++;
  long long res = 0LL;
  if (luckleft > 0)
    res =
        ((long long)ldigs * countways(pat, pos + 1, luckleft - 1)) % 1000000007;
  res =
      (res + (((long long)(digs - ldigs) * countways(pat, pos + 1, luckleft)) %
              1000000007)) %
      1000000007;
  return res;
}
long long nways[10];
long long count2(vector<int> counts, int limit, int left) {
  int sum = accumulate(counts.begin(), counts.end(), 0);
  if (sum == 6) return 1LL;
  long long res = 0LL;
  for (int i = 0; i < limit && left >= i; i++) {
    vector<int> copy(counts);
    copy[i]++;
    res = (res +
           (((long long)nways[i] - counts[i]) * count2(copy, limit, left - i)) %
               1000000007) %
          1000000007;
  }
  return res;
}
int main() {
  string pattern;
  cin >> pattern;
  vector<vector<pair<int, int> > > masks = getMasks(pattern);
  memset(nways, 0LL, sizeof(nways));
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < ((int)masks.size()); j++) {
      nways[i] = (nways[i] + countways(masks[j], 0, i)) % 1000000007;
    }
  }
  nways[0]--;
  long long finalresult = 0LL;
  for (int i = 1; i < 10; i++) {
    vector<int> seed(i, 0);
    finalresult =
        (finalresult + (nways[i] * count2(seed, i, i - 1)) % 1000000007) %
        1000000007;
  }
  cout << finalresult << endl;
  return 0;
}
