#include <bits/stdc++.h>
using namespace std;
const int 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);
}
const long long mod = 1E9 + 7;
long long mul(long long a, long long b) { return (a * b) % mod; }
long long add(long long a, long long b) { return (a + b + 3 * mod) % mod; }
long long mo(long long a) { return (a % mod); }
void norm(long long &a) {
  a %= mod;
  a += 2 * mod;
  a %= mod;
}
long long pot10[100005], only4[100005], only7[100005], pot2[100005];
long long same4[100005], same7[100005], sum_all[100005], ilocz_all[100005];
long long sum_seq[100005], val_seq[100005], ile_seq[100005];
long long licz(string x) {
  long long sum = 0;
  reverse((x).begin(), (x).end());
  val_seq[0] = x[0] - '0';
  if (x[0] == '7') {
    sum_seq[0] = 11;
    ile_seq[0] = 2;
  } else {
    sum_seq[0] = 4;
    ile_seq[0] = 1;
  }
  for (int i = (1); i <= (((int)(x).size()) - 1); ++i) {
    val_seq[i] = add(val_seq[i - 1], mul(x[i] - '0', pot10[i]));
    if (x[i] == '4') {
      ile_seq[i] = ile_seq[i - 1];
      sum_seq[i] = add(mul(only4[i], ile_seq[i - 1]), sum_seq[i - 1]);
    } else {
      ile_seq[i] = add(ile_seq[i - 1], pot2[i]);
      sum_seq[i] =
          add(add(mul(only4[i], pot2[i]), mul(only7[i], ile_seq[i - 1])),
              sum_all[i - 1] + sum_seq[i - 1]);
    }
  }
  {
    if (0)
      cerr << "sum_seq[1]"
           << " = " << sum_seq[1] << endl;
  };
  {
    if (0)
      cerr << "ilocz_all[1]"
           << " = " << ilocz_all[1] << endl;
  };
  {
    if (0)
      cerr << "ile_seq[0]"
           << " = " << ile_seq[0] << endl;
  };
  {
    if (0)
      cerr << "ile_seq[1]"
           << " = " << ile_seq[1] << endl;
  };
  {
    if (0)
      cerr << "ilocz_all[2]"
           << " = " << ilocz_all[2] << endl;
  };
  {
    if (0)
      cerr << "sum_all[1]"
           << " = " << sum_all[1] << endl;
  };
  for (int i = (((int)(x).size()) - 1); i >= (1); --i) {
    if (x[i] == '4') {
      long long a = only4[i] * sum_seq[i - 1] * 2 - only4[i] * same4[i - 1] -
                    only4[i] * val_seq[i - 1];
      long long b = (ile_seq[i - 1] - 1) * mul(only4[i], only4[i]);
      {
        if (0)
          cerr << "sum_seq[i - 1]"
               << " = " << sum_seq[i - 1] << endl;
      };
      {
        if (0)
          cerr << "ile_seq[i - 1]"
               << " = " << ile_seq[i - 1] << endl;
      };
      sum += a + b;
      {
        if (0)
          cerr << "a"
               << " = " << a << endl;
      };
      {
        if (0)
          cerr << "b"
               << " = " << b << endl;
      };
      norm(sum);
    } else {
      long long a = only4[i] * sum_all[i - 1] * 2 - only4[i] * same4[i - 1] -
                    only4[i] * same7[i - 1];
      long long b = only7[i] * sum_seq[i - 1] * 2 - only7[i] * same4[i - 1] -
                    only7[i] * val_seq[i - 1];
      long long c = only4[i] * only7[i] + only4[i] * same4[i - 1] +
                    only7[i] * same7[i - 1] + same4[i - 1] * same7[i - 1];
      {
        if (0)
          cerr << "a"
               << " = " << a << endl;
      };
      {
        if (0)
          cerr << "b"
               << " = " << b << endl;
      };
      {
        if (0)
          cerr << "c"
               << " = " << c << endl;
      };
      long long d = (pot2[i] - 1) * mul(only4[i], only4[i]);
      {
        if (0)
          cerr << "d"
               << " = " << d << endl;
      };
      long long e = (ile_seq[i - 1] - 1) * mul(only7[i], only7[i]);
      long long f = ilocz_all[i - 1];
      {
        if (0)
          cerr << "e"
               << " = " << e << endl;
      };
      {
        if (0)
          cerr << "f"
               << " = " << f << endl;
      };
      sum += a + b + c + d + e + f;
      norm(sum);
    }
  }
  {
    if (0)
      cerr << "sum"
           << " = " << sum << endl;
  };
  if (x[0] == '7') sum += 28;
  norm(sum);
  return sum;
}
void precomp() {
  pot10[0] = pot2[0] = 1;
  for (int i = (1); i <= (100005 - 1); ++i) pot10[i] = mul(pot10[i - 1], 10);
  for (int i = (1); i <= (100005 - 1); ++i) pot2[i] = mul(pot2[i - 1], 2);
  for (int i = (0); i <= (100005 - 1); ++i) {
    only4[i] = mul(4, pot10[i]);
    only7[i] = mul(7, pot10[i]);
  }
  same4[0] = 4;
  same7[0] = 7;
  for (int i = (1); i <= (100005 - 1); ++i) {
    same4[i] = add(same4[i - 1], mul(pot10[i], 4));
    same7[i] = add(same7[i - 1], mul(pot10[i], 7));
  }
  sum_all[0] = (4 + 7);
  ilocz_all[0] = 28;
  for (int i = (1); i <= (100005 - 1); ++i) {
    sum_all[i] = add(add(mul(only4[i], pot2[i]), mul(only7[i], pot2[i])),
                     2 * sum_all[i - 1]);
    ilocz_all[i] = 2 * ilocz_all[i - 1] +
                   mo(2 * sum_all[i - 1] * (only4[i] + only7[i])) -
                   mo(same4[i - 1] * only7[i]) - mo(same7[i - 1] * only4[i]) +
                   mo(same4[i - 1] * same7[i - 1]) + mo(only4[i] * only7[i]) +
                   mo((pot2[i] - 1) * mul(only4[i], only4[i])) +
                   mo((pot2[i] - 1) * mul(only7[i], only7[i]));
    norm(ilocz_all[i]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  precomp();
  string dol, gora;
  cin >> dol >> gora;
  long long a, b;
  a = licz(dol);
  b = licz(gora);
  b = add(-a, b);
  cout << b << endl;
  return 0;
}
