#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 10010;
LL l, r, sum, cnt;
LL a[N];
void fun(LL x)
{
if(x > 4444444444)return;
a[++cnt] = x * 10 + 4;
a[++cnt] = x * 10 + 7;
fun(x * 10 + 4);
fun(x * 10 + 7);
}
int main()
{
cin>>l>>r;
fun(0);
sort(a + 1, a + 1 + cnt);
LL x = lower_bound(a + 1, a + 1 + cnt, l) - a;
LL y = lower_bound(a + 1, a + 1 + cnt, r) - a;
if(x == y)
{
cout<<(r - l + 1) * a[x]<<endl;
return 0;
}
for(LL i = x; i <= y; i ++)
{
if(i == x)sum += (a[x] - l + 1) * a[i];
else if(i == y)sum += (r - a[i - 1]) * a[i];
else sum += (a[i] - a[i - 1]) * a[i];
}
cout<<sum<<endl;
return 0;
}