#include <bits/stdc++.h>
using namespace std;
char s1[100100], s2[100100];
long long ini;
long long mod(long long a) {
  return ((a % 1000000007LL) + 1000000007LL) % 1000000007LL;
}
long long func(char* s, int t, bool som) {
  long long r = 0;
  long long ul = 0;
  long long soma = 0, ls = ini;
  long long qt = 0LL;
  bool tem = false;
  long long sum, lst, val, bas, qtd;
  sum = lst = ini;
  val = 0;
  bas = 3LL;
  qtd = 1LL;
  for (int i = t - 1, j = 0; i >= 0; i--, j++) {
    ul = (ul * 10 + s[j] - '0') % 1000000007LL;
    long long bas2 = (bas * bas) % 1000000007LL;
    if (s[i] == '7') {
      if (qt > 0)
        r = (r + ((qt - 1) * bas2) % 1000000007LL +
             (bas * (2 * soma - ls - ini)) % 1000000007LL +
             (lst * (ini + bas)) % 1000000007LL) %
            1000000007LL;
      r = (r + val) % 1000000007LL;
      soma = (soma + sum + qt * bas) % 1000000007LL;
      qt = (qt + qtd) % 1000000007LL;
      if (tem) ls = (ls + bas) % 1000000007LL;
      tem = true;
    } else if (!tem)
      ls = (ls + bas) % 1000000007LL;
    val = (2 * val + (lst * (bas + ini)) % 1000000007LL +
           (bas2 * (qtd - 1)) % 1000000007LL +
           (bas * (2 * sum - lst - ini)) % 1000000007LL) %
          1000000007LL;
    sum = (2 * sum + qtd * bas) % 1000000007LL;
    lst = (lst + bas) % 1000000007LL;
    bas = (bas * 10) % 1000000007LL;
    qtd = (qtd * 2) % 1000000007LL;
  }
  if (tem) return (r + ul * ls) % 1000000007LL;
  return r;
}
int main() {
  int tam;
  scanf("%s %s", s1, s2);
  tam = strlen(s1);
  ini = 0;
  for (int i = 0; i < tam; i++) ini = (ini * 10 + 4LL) % 1000000007LL;
  cout << mod(func(s2, tam, true) - func(s1, tam, false)) << endl;
  return 0;
}
