#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
const int mod = 1000000007;
struct num {
  int x;
  num() : x(0) {}
  num(int x) : x(x) {}
  num operator+(const num& o) const {
    num res(x + o.x);
    if (res.x >= mod) res.x -= mod;
    return res;
  }
  num operator-(const num& o) const {
    num res(x - o.x);
    if (res.x < 0) res.x += mod;
    return res;
  }
  num operator*(const num& o) const { return num(x * (long long)o.x % mod); }
};
struct MAGIC {
  num T;
  num S;
  num n;
  num a1;
  num an;
};
MAGIC add(const MAGIC& m, num x) {
  MAGIC res;
  res.n = m.n;
  res.a1 = m.a1 + x;
  res.an = m.an + x;
  res.S = m.S + m.n * x;
  res.T = m.T + (m.n - num(1)) * x * x + x * (num(2) * m.S - m.a1 - m.an);
  return res;
}
MAGIC merge(const MAGIC& m1, const MAGIC& m2) {
  MAGIC res;
  res.n = m1.n + m2.n;
  res.a1 = m1.a1;
  res.an = m2.an;
  res.S = m1.S + m2.S;
  res.T = m1.T + m2.T + m1.an * m2.a1;
  return res;
}
num solve(const string& s) {
  MAGIC mall;
  mall.a1 = num(4);
  mall.an = num(7);
  mall.n = num(2);
  mall.S = num(4 + 7);
  mall.T = num(4 * 7);
  MAGIC msuff;
  if (s[int((s).size()) - 1] == '7')
    msuff = mall;
  else {
    msuff.n = num(1);
    msuff.a1 = num(4);
    msuff.an = num(4);
    msuff.S = num(4);
    msuff.T = num(0);
  }
  num ten(1);
  for (int i = int((s).size()) - 2; i >= 0; --i) {
    ten = ten * num(10);
    if (s[i] == '4')
      msuff = add(msuff, ten * num(4));
    else {
      msuff = merge(add(mall, ten * num(4)), add(msuff, ten * num(7)));
    }
    mall = merge(add(mall, ten * num(4)), add(mall, ten * num(7)));
  }
  return msuff.T;
}
int main() {
  string sl, sr;
  cin >> sl >> sr;
  num r1 = solve(sr);
  num r2 = solve(sl);
  num res = r1 - r2;
  printf("%d\n", res.x);
  return 0;
}
