// ~~ icebear love attttttt ~~
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
template<class T>
bool minimize(T &a, const T &b) {
if (a > b) return a = b, true;
return false;
}
template<class T>
bool maximize(T &a, const T &b) {
if (a < b) return a = b, true;
return false;
}
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORR(i,a,b) for(int i=(a); i>=(b); --i)
#define REP(i, n) for(int i=0; i<(n); ++i)
#define RED(i, n) for(int i=(n)-1; i>=0; --i)
#define MASK(i) (1LL << (i))
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define task "icebearat"
const int MOD = 1e9 + 7;
const int inf = 1e9 + 27092008;
const ll INF = 1e18 + 27092008;
const int N = 100 + 5;
int dp[N][10][2][2];
string L, R;
vector<int> digit;
int DP(int pos, int last, bool start, bool smaller) {
if (pos < 0) return start;
int &ret = dp[pos][last][start][smaller];
if (~ret) return ret;
ret = 0;
int limit = (smaller ? 9 : digit[pos]);
FOR(i, 0, limit) {
bool newSt = (start | (i > 0));
if (!newSt || i != last)
ret = (ret + DP(pos - 1, i, newSt, smaller | (i < limit))) % MOD;
}
return ret;
}
int f(string &x) {
if (x == "0") return 0;
digit.clear();
for(char c : x) digit.pb(c - '0');
reverse(all(digit));
memset(dp, -1, sizeof dp);
return DP((int)digit.size() - 1, 0, 0, 0);
}
int check(string &x) {
FOR(i, 1, (int)x.size() - 1) if (x[i] == x[i - 1]) return -1;
return 1;
}
void init(void) {
cin >> L >> R;
}
void process(void) {
cout << (f(R) - f(L) + check(L) + MOD) % MOD;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
int tc = 1;
// cin >> tc;
while(tc--) {
init();
process();
}
return 0;
}
Ly8gfn4gaWNlYmVhciBsb3ZlIGF0dHR0dHR0IH5+CiNpbmNsdWRl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Pj4gTCA+PiBSOwp9Cgp2b2lkIHByb2Nlc3Modm9pZCkgewogICAgY291dCA8PCAoZihSKSAtIGYoTCkgKyBjaGVjayhMKSArIE1PRCkgJSBNT0Q7Cn0KCmludCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsKICAgIGNpbi50aWUoMCk7IGNvdXQudGllKDApOwogICAgaWYgKGZvcGVuKHRhc2siLmlucCIsICJyIikpIHsKICAgICAgICBmcmVvcGVuKHRhc2siLmlucCIsICJyIiwgc3RkaW4pOwogICAgICAgIGZyZW9wZW4odGFzayIub3V0IiwgInciLCBzdGRvdXQpOwogICAgfQogICAgaW50IHRjID0gMTsKLy8gICAgY2luID4+IHRjOwogICAgd2hpbGUodGMtLSkgewogICAgICAgIGluaXQoKTsKICAgICAgICBwcm9jZXNzKCk7CiAgICB9CiAgICByZXR1cm4gMDsKfQoK