#include <bits/stdc++.h>
using namespace std;
const int maxn = 200020;
const int maxx = 10000;
const int MOd = 1e9 + 7;
const int K = 750;
struct data {
  int l, r, top, ken, s;
  data(int a = 0, int b = 0, int c = 0, int d = 0, int e = 0) {
    l = a;
    r = b;
    top = c;
    ken = d;
    s = e;
  }
} dn[maxn][2][2][2];
int a, b, us[maxn];
char ar[maxn];
char bs[maxn];
bool used[maxn][2][2][2];
int mul(int a, int b) { return (long long)a * b % MOd; }
int add(int a, int b) { return (a + b) >= MOd ? a + b - MOd : a + b; }
data f(int n, int b, int s, int z) {
  if (n == 0) return data(0, 0, 0, 0, 1);
  data &ret = dn[n][b][s][z];
  if (used[n][b][s][z]) return ret;
  used[n][b][s][z] = 1;
  data t;
  data t2;
  if (z && !(b && ar[n] > '0')) {
    t2 = f(n - 1, b && (ar[n] == '0'), s && (bs[n] == '0'), 1);
    ret = t2;
  }
  if (!(b && ar[n] > '4') && !(s && bs[n] < '4')) {
    t = f(n - 1, b && (ar[n] == '4'), s && (bs[n] == '4'), 0);
    assert(t.s);
    ret.ken =
        add(ret.ken,
            add(t.ken, mul(add(add(t.top, t.top), add(MOd - t.l, MOd - t.r)),
                           mul(4, us[n]))));
    ret.ken = add(ret.ken, mul(mul(us[n + n - 1], 16), MOd + t.s - 1));
    ret.top = add(ret.top, add(mul(4, mul(t.s, us[n])), t.top));
    ret.s = add(t.s, ret.s);
    ret.r = add(t.r, mul(4, us[n]));
    if (t2.s) {
      ret.ken = add(ret.ken, mul(add(mul(4, us[n]), t.l), t2.r));
    } else {
      ret.l = add(t.l, mul(4, us[n]));
    }
    t2 = t;
  }
  if (!(b && ar[n] > '7') && !(s && bs[n] < '7')) {
    t = f(n - 1, b && (ar[n] == '7'), s && (bs[n] == '7'), 0);
    assert(t.s);
    ret.ken =
        add(ret.ken,
            add(t.ken, mul(add(add(t.top, t.top), add(MOd - t.l, MOd - t.r)),
                           mul(7, us[n]))));
    ret.ken = add(ret.ken, mul(mul(us[n + n - 1], 49), t.s - 1));
    ret.top = add(ret.top, add(mul(7, mul(t.s, us[n])), t.top));
    ret.r = add(t.r, mul(7, us[n]));
    ret.s = add(ret.s, t.s);
    if (t2.s) {
      ret.ken =
          add(ret.ken, mul(add(mul(7, us[n]), t.l), add(mul(4, us[n]), t2.r)));
    } else {
      ret.l = add(t.l, mul(7, us[n]));
    }
  }
  return ret;
}
int main() {
  scanf(" %s", ar + 1);
  scanf(" %s", bs + 1);
  a = strlen(ar + 1);
  b = strlen(bs + 1);
  reverse(ar + 1, ar + 1 + a);
  reverse(bs + 1, bs + 1 + b);
  us[1] = 1;
  for (int i = 2; i <= b + b; i++) us[i] = mul(us[i - 1], 10);
  a = b;
  data t = f(b, 1, 1, 1);
  printf("%d\n", t.ken);
  return 0;
}
