#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool Up(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool Down(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
inline int getus() {
  int tmp, c;
  while (tmp = fgetc(stdin), tmp < '0' || tmp > '9')
    ;
  tmp -= '0';
  while (c = fgetc(stdin), '0' <= c && c <= '9') tmp = tmp * 10 + c - '0';
  return tmp;
}
inline int getint() {
  int tmp, c, flag;
  while (flag = fgetc(stdin), flag != '-' && (flag < '0' || flag > '9'))
    ;
  if (flag == '-')
    tmp = 0;
  else
    tmp = flag - '0';
  while (c = fgetc(stdin), '0' <= c && c <= '9') tmp = tmp * 10 + c - '0';
  return flag == '-' ? -tmp : tmp;
}
int N;
long long F[1000022], G[1000022], pw2[1000022], pw10[1000022], digit[1000022];
long long Calc(string str) {
  if (count(str.begin(), str.end(), '7') == 0) return 0;
  long long ans = 0, last = 0;
  reverse(str.begin(), str.end());
  for (int i = (N - 1); i >= (0); --i) {
    if (str[i] == '7') {
      if (i == 0) {
        ans += (last + 4) * (last + 7) % 1000000007;
        ans %= 1000000007;
        last = (last + pw10[i] * 7) % 1000000007;
      } else {
        last = (last + pw10[i] * 4) % 1000000007;
        long long sum = 11 * (digit[i] * pw2[i] % 1000000007) % 1000000007;
        long long t1 = last * last % 1000000007 * (pw2[i] - 1) % 1000000007;
        long long t2 = ((sum - 11 * digit[i]) % 1000000007 + 1000000007) %
                       1000000007 * last % 1000000007;
        long long t3 = F[i];
        long long t4 = (last + 7 * digit[i]) % 1000000007;
        long long t5 = (last + pw10[i] * 3 + 4 * digit[i]) % 1000000007;
        ans = (ans + t1 + t2 + t3) % 1000000007;
        ans = (ans + t4 * t5) % 1000000007;
        if (ans < 0) ans += 1000000007;
        last = (last + pw10[i] * 3) % 1000000007;
      }
    } else {
      last += pw10[i] * 4;
      last %= 1000000007;
    }
  }
  return ans;
}
void Prepare(int N) {
  pw2[0] = pw10[0] = 1;
  digit[0] = 0;
  for (int i = (1); i <= (N); ++i) {
    pw2[i] = pw2[i - 1] * 2 % 1000000007;
    pw10[i] = pw10[i - 1] * 10 % 1000000007;
    digit[i] = (digit[i - 1] * 10 + 1) % 1000000007;
  }
  F[1] = 28;
  G[1] = 65;
  for (int i = (1); i < (N); ++i) {
    F[i + 1] = 100 * (F[i] + G[i]) +
               (1210 * pw2[i] - 560) % 1000000007 * digit[i] +
               28 * (pw2[i + 1] - 1);
    G[i + 1] = 200 * G[i] + 1210 * pw2[i] % 1000000007 * digit[i] + 65 * pw2[i];
    F[i + 1] %= 1000000007;
    if (F[i + 1] < 0) F[i + 1] += 1000000007;
    G[i + 1] %= 1000000007;
    if (G[i + 1] < 0) G[i + 1] += 1000000007;
  }
}
int main() {
  string L, R;
  cin >> L >> R;
  Prepare(N = L.size());
  cout << (Calc(R) - Calc(L) + 1000000007) % 1000000007 << endl;
  return 0;
}
