#include <bits/stdc++.h>
using namespace std;
char s[100005];
int n, p[100005];
long long Ans;
long long pow0[100005], sum0[100005], pow2[100005], size[100005], data[100005],
    orzz[100005];
long long pow4[100005], pow7[100005], num[100005], num0[100005], sum4[100005],
    sum7[100005], Mx;
void Init() {
  pow2[0] = 1;
  for (int i = 1; i <= n; i++) pow2[i] = pow2[i - 1] * 2 % 1000000007;
  pow0[0] = 1;
  for (int i = 1; i <= n; i++) pow0[i] = pow0[i - 1] * 10 % 1000000007;
  pow4[0] = 4;
  for (int i = 1; i <= n; i++) pow4[i] = pow0[i] * 4 % 1000000007;
  pow7[0] = 7;
  for (int i = 1; i <= n; i++) pow7[i] = pow0[i] * 7 % 1000000007;
  sum0[0] = 1;
  for (int i = 1; i <= n; i++)
    sum0[i] = sum0[i - 1] + pow0[i], sum0[i] %= 1000000007;
  sum4[0] = 4;
  for (int i = 1; i <= n; i++)
    sum4[i] = sum4[i - 1] + pow0[i] * 4, sum4[i] %= 1000000007;
  sum7[0] = 7;
  for (int i = 1; i <= n; i++)
    sum7[i] = sum7[i - 1] + pow0[i] * 7, sum7[i] %= 1000000007;
  num0[0] = 11;
  for (int i = 1; i <= n; i++)
    num0[i] = num0[i - 1] * 2 + (pow4[i] + pow7[i]) * pow2[i],
    num0[i] %= 1000000007;
}
void read() {
  scanf("%s", s);
  n = strlen(s) - 1;
  for (int i = 0; i <= n; i++) p[i] = (s[n - i] == '7');
}
long long calc() {
  long long Ret = 0;
  Init();
  num[0] = p[0] + 1;
  for (int i = 1; i <= n; i++)
    num[i] = (num[i - 1] + p[i] * pow2[i]) % 1000000007;
  orzz[0] = 11;
  for (int i = 1; i <= n; i++) {
    orzz[i] += orzz[i - 1] + sum4[i - 1] + pow7[i] * (pow2[i] * 2 - 1);
    orzz[i] %= 1000000007;
    orzz[i] += orzz[i - 1] + sum7[i - 1] + pow4[i] * (pow2[i] * 2 - 1);
    orzz[i] %= 1000000007;
  }
  size[0] = 4 + 7 * p[0];
  for (int i = 1; i <= n; i++)
    if (p[i]) {
      size[i] += num0[i - 1] + pow4[i] * pow2[i];
      size[i] %= 1000000007;
      size[i] += pow7[i] * num[i - 1] + size[i - 1];
      size[i] %= 1000000007;
    } else {
      size[i] += pow4[i] * num[i - 1] + size[i - 1];
      size[i] %= 1000000007;
    }
  for (int i = 0; i <= n; i++) size[i] = size[i] * 2 % 1000000007;
  data[0] = 28;
  for (int i = 1; i <= n; i++) {
    data[i] += data[i - 1] + pow4[i] * orzz[i - 1] +
               pow4[i] * pow4[i] % 1000000007 * (pow2[i] - 1);
    data[i] %= 1000000007;
    data[i] += data[i - 1] + pow7[i] * orzz[i - 1] +
               pow7[i] * pow7[i] % 1000000007 * (pow2[i] - 1);
    data[i] %= 1000000007;
    data[i] += pow7[i] * pow4[i] + pow7[i] * sum7[i - 1] +
               pow4[i] * sum4[i - 1] + sum4[i - 1] * sum7[i - 1];
    data[i] %= 1000000007;
  }
  for (int i = 0; i <= n - 1; i++) {
    Ret += data[i] + sum4[i] * sum7[i] + sum7[i] * pow4[i + 1];
    Ret %= 1000000007;
  }
  Ret += p[0] * 28;
  Ret %= 1000000007;
  Mx = 4 + p[0] * 3;
  for (int i = 1; i <= n; i++)
    if (p[i]) {
      Ret += data[i - 1] + pow4[i] * orzz[i - 1] +
             pow4[i] * pow4[i] % 1000000007 * (pow2[i] - 1);
      Ret %= 1000000007;
      Ret += pow7[i] * (size[i - 1] - Mx - sum4[i - 1]) +
             pow7[i] * pow7[i] % 1000000007 * (num[i - 1] - 1);
      Ret %= 1000000007;
      Ret += pow7[i] * pow4[i] + pow7[i] * sum7[i - 1] + pow4[i] * sum4[i - 1] +
             sum4[i - 1] * sum7[i - 1];
      Ret %= 1000000007;
      Mx += pow7[i];
      Mx %= 1000000007;
    } else {
      Ret += pow4[i] * (size[i - 1] - Mx - sum4[i - 1]) +
             pow4[i] * pow4[i] % 1000000007 * (num[i - 1] - 1);
      Ret %= 1000000007;
      Mx += pow4[i];
      Mx %= 1000000007;
    }
  for (int i = 0; i <= n; i++)
    pow0[i] = sum0[i] = pow2[i] = size[i] = data[i] = orzz[i] = pow4[i] =
        pow7[i] = num[i] = num0[i] = sum4[i] = sum7[i] = 0;
  return Ret;
}
int main() {
  read();
  Ans -= calc();
  read();
  Ans += calc();
  if (Ans < 0) Ans += 1000000007;
  if (Ans >= 1000000007) Ans -= 1000000007;
  printf("%I64d\n", Ans);
}
