#include <bits/stdc++.h>
using namespace std;
int C(int n, int i) {
  int a = 1;
  for (int j = n - i + 1; j <= n; j++) a *= j;
  for (int j = i; j > 0; j--) a /= j;
  return a;
}
int main() {
  vector<int> m;
  vector<int>::iterator it;
  char c;
  while (true) {
    cin.get(c);
    if (c == '\n') break;
    m.push_back(c - 48);
  }
  int length = m.size();
  vector<int> no47(length + 1, 0);
  int n = length - 1;
  int a = 0;
  for (it = m.begin(); it != m.end(); it++) {
    int no[n + 1];
    for (int i = 0; i <= n; i++) no[i] = C(n, i) << (3 * n - 2 * i);
    int b = (*it > 4) + (*it > 7);
    for (int i = 0; i <= n; i++) {
      no47[a + i] += (*it - b) * no[i];
      no47[a + i + 1] += b * no[i];
    }
    if (*it == 4 || *it == 7) a++;
    n--;
  }
  no47[0]--, no47[a]++;
  int more[length + 1];
  more[length] = 0;
  for (int i = length - 1; i >= 0; i--) more[i] = more[i + 1] + no47[i + 1];
  long long ans = 0;
  int i[6];
  for (i[0] = 0; i[0] <= length; i[0]++)
    for (i[1] = 0; i[1] <= length; i[1]++)
      for (i[2] = 0; i[2] <= length; i[2]++)
        for (i[3] = 0; i[3] <= length; i[3]++)
          for (i[4] = 0; i[4] <= length; i[4]++)
            for (i[5] = 0; i[5] <= length; i[5]++) {
              int b = 0;
              for (int j = 0; j < 6; j++) b += i[j];
              if (b < length) {
                int appear[length + 1];
                for (int j = 0; j <= b; j++) appear[j] = 0;
                long long c = more[b];
                for (int j = 0; j < 6; j++) {
                  int k = i[j];
                  c = (c * (no47[k] - appear[k])) % 1000000007;
                  appear[k]++;
                }
                ans = (ans + c) % 1000000007;
              }
            }
  cout << ans;
  return 0;
}
