#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-12;
const int INF = 999999999;
const int kMod = 1000000007;
const int kMaxN = 100010;
char a[kMaxN], b[kMaxN];
int p10[kMaxN], p2[kMaxN], seq[kMaxN];
int F[kMaxN], S[kMaxN];
int P10(int n) {
  int &res = p10[n];
  if (res != -1) return res;
  return res = (n == 0) ? 1 : ((long long)P10(n - 1) * 10) % kMod;
}
int P2(int n) {
  int &res = p2[n];
  if (res != -1) return res;
  return res = (n == 0) ? 1 : ((long long)P2(n - 1) * 2) % kMod;
}
int ComSeq(int n) {
  int &res = seq[n];
  if (res != -1) return res;
  if (n == 0) return res = 0;
  return res = ((long long)ComSeq(n - 1) * 10 + 1) % kMod;
}
int ComS(int n) {
  int &res = S[n];
  if (res != -1) return res;
  if (n == 0) return res = 0;
  res = ((long long)ComS(n - 1) * 20) % kMod;
  res = (res + (long long)P2(n - 1) * 11) % kMod;
  return res;
}
int ComG(int n) {
  int res = ((long long)ComS(n) * 2) % kMod;
  res = (res - (long long)ComSeq(n) * 11) % kMod;
  return res;
}
int ComF(int n) {
  int &res = F[n];
  if (res != -1) return res;
  res = 0;
  if (n == 0) return res;
  int p = ((long long)P10(n - 1) * 4) % kMod;
  int w1 = (p + (long long)ComSeq(n - 1) * 7) % kMod;
  res = (res + (((long long)p * p) % kMod) * (P2(n - 1) - 1)) % kMod;
  res = (res + p * (long long)ComG(n - 1)) % kMod;
  res = (res + ComF(n - 1)) % kMod;
  p = ((long long)P10(n - 1) * 7) % kMod;
  int w2 = (p + (long long)ComSeq(n - 1) * 4) % kMod;
  res = (res + (((long long)p * p) % kMod) * (P2(n - 1) - 1)) % kMod;
  res = (res + p * (long long)ComG(n - 1)) % kMod;
  res = (res + ComF(n - 1)) % kMod;
  res = (res + (long long)w1 * w2) % kMod;
  return res;
}
int Solve(const char a[]) {
  int n = strlen(a);
  int res = 0;
  int prefix = 0;
  for (int i = n - 1; i >= 0; --i) {
    int d = a[n - 1 - i] - '0';
    int next_prefix = (prefix + (long long)P10(i) * d) % kMod;
    if (d == 7) {
      int p = (prefix + (long long)P10(i) * 4) % kMod;
      if (i > 0) {
        res = (res + (((long long)p * p) % kMod) * (P2(i) - 1)) % kMod;
        res = (res + (long long)p * ComG(i)) % kMod;
        res = (res + ComF(i)) % kMod;
      }
      int w1 = (p + (long long)ComSeq(i) * 7) % kMod;
      int w2 = (next_prefix + (long long)ComSeq(i) * 4) % kMod;
      res = (res + (long long)w1 * w2) % kMod;
    }
    prefix = next_prefix;
  }
  return res;
}
int main() {
  scanf("%s", a);
  scanf("%s", b);
  memset(p10, -1, sizeof(p10));
  memset(p2, -1, sizeof(p2));
  memset(seq, -1, sizeof(seq));
  memset(F, -1, sizeof(F));
  memset(S, -1, sizeof(S));
  int res = Solve(b);
  res = (res - Solve(a)) % kMod;
  if (res < 0) res += kMod;
  printf("%d\n", res);
  return 0;
}
