#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 101000;
long long sten[maxn], sfou[maxn], ssev[maxn];
long long sum[maxn][2], squ[maxn][2], num[maxn][2];
int r[maxn], len;
long long ans;
char s[maxn];
bool vis[maxn][2];
void pre() {
  sten[1] = 1;
  for (int i = 2; i < maxn; i++) sten[i] = (sten[i - 1] * 10) % mod;
  sfou[1] = 4;
  ssev[1] = 7;
  for (int i = 2; i < maxn; i++) {
    sfou[i] = (sfou[i - 1] + 4 * sten[i]) % mod;
    ssev[i] = (ssev[i - 1] + 7 * sten[i]) % mod;
  }
}
long long mul(long long a, long long b, long long c) {
  return (((a * b) % mod) * c) % mod;
}
void dfs(int p) {
  if (p == 0) return;
  if (r[p] == 7) {
    long long a = (4 * sten[p] + ssev[p - 1]) % mod,
              b = (7 * sten[p] + sfou[p - 1]) % mod;
    ans = (ans + mul(squ[p][1], sten[p + 1], sten[p + 1]) +
           mul(a, b, num[p][1]) + mul(a + b, sum[p][1], sten[p + 1])) %
          mod;
    ans = (ans + mul(squ[p][0], sten[p + 1], sten[p + 1]) +
           mul(a, b, num[p][0]) + mul(a + b, sum[p][0], sten[p + 1])) %
          mod;
    sum[p - 1][0] = (sum[p][1] * 10 + 4 * num[p][1] + sum[p][0] * 20 +
                     (4 + 7) * num[p][0]) %
                    mod;
    squ[p - 1][0] = (squ[p][1] * 100 + 4 * 4 * num[p][1] + 20 * 4 * sum[p][1] +
                     squ[p][0] * 100 * 2 + 4 * 4 * num[p][0] +
                     7 * 7 * num[p][0] + 20 * (4 + 7) * sum[p][0]) %
                    mod;
    num[p - 1][0] = (num[p][1] + num[p][0] * 2) % mod;
    sum[p - 1][1] = (sum[p][1] * 10 + 7 * num[p][1]) % mod;
    squ[p - 1][1] =
        (squ[p][1] * 100 + 7 * 7 * num[p][1] + 20 * 7 * sum[p][1]) % mod;
    num[p - 1][1] = num[p][1];
  } else {
    long long a = (4 * sten[p] + ssev[p - 1]) % mod,
              b = (7 * sten[p] + sfou[p - 1]) % mod;
    ans = (ans + mul(squ[p][0], sten[p + 1], sten[p + 1]) +
           mul(a, b, num[p][0]) + mul(a + b, sum[p][0], sten[p + 1])) %
          mod;
    sum[p - 1][0] = (sum[p][0] * 20 + (4 + 7) * num[p][0]) % mod;
    squ[p - 1][0] = (squ[p][0] * 100 * 2 + 4 * 4 * num[p][0] +
                     7 * 7 * num[p][0] + 20 * (4 + 7) * sum[p][0]) %
                    mod;
    num[p - 1][0] = (num[p][0] * 2) % mod;
    sum[p - 1][1] = (sum[p][1] * 10 + 4 * num[p][1]) % mod;
    squ[p - 1][1] =
        (squ[p][1] * 100 + 4 * 4 * num[p][1] + 20 * 4 * sum[p][1]) % mod;
    num[p - 1][1] = num[p][1];
  }
  dfs(p - 1);
}
void work() {
  memset(vis, 0, sizeof(vis));
  memset(sum, 0, sizeof(sum));
  memset(squ, 0, sizeof(squ));
  memset(num, 0, sizeof(num));
  ans = 0;
  num[len][1] = 1;
  sum[len][1] = squ[len][1] = 0;
  dfs(len);
}
int main() {
  pre();
  scanf("%s", s);
  len = strlen(s);
  for (int i = len; i >= 1; i--) r[i] = s[len - i] - '0';
  work();
  long long res1 = ans;
  scanf("%s", s);
  for (int i = len; i >= 1; i--) r[i] = s[len - i] - '0';
  work();
  long long res2 = ans;
  cout << ((res2 - res1 + mod) % mod) << endl;
  return 0;
}
