#include <bits/stdc++.h>
using namespace std;
const long long INF = 1E9 + 7;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
long long MOD = 1E9 + 7;
long long pot(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n % 2) res = (res * a) % MOD;
    a = (a * a) % MOD;
    n /= 2;
  }
  return res;
}
long long p2[100007], p10[100007];
pair<long long, long long> operator+(pair<long long, long long> a,
                                     pair<long long, long long> b) {
  return pair<long long, long long>((a.first + b.first) % MOD,
                                    (a.second + b.second) % MOD);
}
long long mn(long long a, long long b) { return (a * b) % MOD; }
void ust(pair<long long, long long>& p) {
  p.first %= MOD;
  p.second %= MOD;
  if (p.first < 0) p.first += MOD;
  if (p.second < 0) p.second += MOD;
}
pair<long long, long long> join(pair<long long, long long> p, long long val,
                                long long licz) {
  return pair<long long, long long>(
      (p.first + 2 * val * licz) % MOD,
      (p.second + mn(val, p.first) + mn(mn(val, val), licz)) % MOD);
}
pair<long long, long long> full[100007], dp[100007], inter[100007];
long long inv9 = pot(9, MOD - 2);
string l, r;
long long sol(string s) {
  int n = ((int)(s).size());
  reverse((s).begin(), (s).end());
  dp[1] = (s[0] == '4' ? pair<long long, long long>(0, 0)
                       : pair<long long, long long>(4 + 7, 4 * 7));
  long long count = (s[0] == '7');
  for (int i = (2); i <= (n); ++i) {
    dp[i] = join(dp[i - 1], mn(p10[i - 1], s[i - 1] - '0'), count);
    if (s[i - 1] == '7') {
      dp[i] = dp[i] + join(full[i - 1], mn(p10[i - 1], 4), p2[i - 1] - 1) +
              inter[i];
      count = (count + p2[i - 1]) % MOD;
    }
    ust(dp[i]);
  }
  return dp[n].second;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  cin >> l >> r;
  p2[0] = p10[0] = 1;
  for (int i = (1); i <= (100007 - 1); ++i)
    p2[i] = mn(p2[i - 1], 2), p10[i] = mn(p10[i - 1], 10);
  full[1] = pair<long long, long long>(4 + 7, 4 * 7);
  for (int i = (2); i <= (100007 - 1); ++i) {
    full[i] = join(full[i - 1], mn(p10[i - 1], 4), p2[i - 1] - 1);
    full[i] = full[i] + join(full[i - 1], mn(p10[i - 1], 7), p2[i - 1] - 1);
    inter[i].first += mn(mn((p10[i] - 1), inv9), (4 + 7));
    long long x = mn(p10[i - 1] - 1, inv9);
    inter[i].second += mn(x, p10[i - 1]) * (4 * 4 + 7 * 7);
    inter[i].second += mn(x, x) * 4 * 7;
    inter[i].second += mn(p10[i - 1], p10[i - 1]) * 4 * 7;
    ust(inter[i]);
    full[i] = full[i] + inter[i];
    ust(full[i]);
  }
  long long res = sol(r) - sol(l);
  res %= MOD;
  if (res < 0) res += MOD;
  cout << res << endl;
  return 0;
}
