#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
  bool fu = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') fu = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (fu) x = -x;
};
inline char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
const int mod = 1000000007;
int n, i, j, k, w;
char st[1000010];
int a[1000010];
bool vis[100010][2];
long long T[100010], p[100010][2], l[100010][2], g[100010][2], s[100010][2],
    v[100010][2];
void get(int i, bool l0) {
  if (vis[i][l0]) return;
  vis[i][l0] = 1;
  if (i > w) {
    g[i][l0] = 1;
    return;
  }
  bool l2;
  long long c, LA = 0, Y;
  bool fir = 1;
  for (int j = 4; j <= 7; j += 3)
    if (l0 || (j <= a[i])) {
      c = j * T[w - i] % mod;
      l2 = l0 || (j < a[i]);
      get(i + 1, l2);
      g[i][l0] = ((g[i][l0]) + (g[i + 1][l2]) % mod) % mod;
      s[i][l0] = ((s[i][l0]) + (s[i + 1][l2] + c * g[i + 1][l2]) % mod) % mod;
      v[i][l0] = ((v[i][l0]) + (v[i + 1][l2]) % mod) % mod;
      v[i][l0] =
          ((v[i][l0]) +
           ((2 * s[i + 1][l2] - p[i + 1][l2] - l[i + 1][l2]) % mod * c) % mod) %
          mod;
      v[i][l0] =
          ((v[i][l0]) + (c * c % mod * (g[i + 1][l2] - 1) % mod) % mod) % mod;
      Y = (p[i + 1][l2] + c) % mod;
      if (!fir) v[i][l0] = ((v[i][l0]) + (LA * Y % mod) % mod) % mod;
      if (fir) fir = 0, p[i][l0] = Y;
      LA = l[i][l0] = (l[i + 1][l2] + c) % mod;
      fir = 0;
    }
}
long long solve() {
  scanf("%s", st + 1);
  w = strlen(st + 1);
  for (i = 1; i <= w; i++) a[i] = st[i] - '0';
  T[0] = 1;
  for (i = 1; i <= w; i++) T[i] = T[i - 1] * 10 % mod;
  memset(vis, 0, sizeof(vis));
  memset(p, 0, sizeof(p));
  memset(l, 0, sizeof(l));
  memset(g, 0, sizeof(g));
  memset(s, 0, sizeof(s));
  memset(v, 0, sizeof(v));
  get(1, 0);
  return v[1][0];
}
int main() {
  long long s0 = solve();
  long long s1 = solve();
  s0 = (s1 - s0) % mod;
  if (s0 < 0) s0 += mod;
  cout << s0 << endl;
  scanf("\n");
  return 0;
}
