Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Let *next*(*x*) be the minimum lucky number which is larger than or equals *x*. Petya is interested what is the value of the expression *next*(*l*) + *next*(*l* + 1) + ... + *next*(*r* - 1) + *next*(*r*). Help him solve this problem.
The single line contains two integers *l* and *r* (1 ≤ *l* ≤ *r* ≤ 10<sup class="upper-index">9</sup>) — the left and right interval limits.
2 7
33
7 7
7
1 9
125
4 7
25
12 47
1593
6 77
4012
1 100
14247
1000000000 1000000000
4444444444
77 77
77
69 788
452195
474 747
202794
4 77777
4070145675
1 1000000
1394675359387
47 744447
381286992761
47444 1000000000
1394672348253941136
48 854888
749733199853
854444 985555
582719941728
774744 774747
3098985
654 987654
1339803940266
477777 1000000000
1394672167300009765
77777 777777777
407018021649898097
963 85555574
7526978888069560
47 7444
38125896
1 1000000000
1394672350065645019
474 999888555
1394177038954402791
777 1000000000
1394672350065239125
7 777777774
407018023386632646
369 852
606732
47 47
47
747 748
1521
77777440 77777444
388887220
987545885 999875584
54798666661186800
2 777777776
407018024942188226
1 1
4
1 2
8
999999999 1000000000
8888888888
777777777 1000000000
987654325123456789
777777778 1000000000
987654324345679012
5 6
14
49 49
74
6 6
7
3 4
8
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp" 
#define   ll                                long long int
#define   ull                               unsigned long long int
#define   cint                              const int
#define   debug(x)                          cout << #x << " = ";
#define   fo(i,a,b)                         for(int i=a;i<b;++i)
#define   rfo(i,a,b)                        for(int i=a-1;i>=b;--i)
#define   foll(i,a,b)                       for(ll i = a; i < b; ++i)
#define   rfoll(i,a,b)                      for(ll i = a-1; i >= b; --i)
#define   sqr(x)                            (x)*(x)
#define   ii                                pair<int,int>
#define   vLL                               vector<ll>
#define   vi                                vector<int>
#define   vS                                vector<string>
#define   pb                                push_back
#define   ppb                               pop_back
#define   eb                                emplace_back
#define   lbd                               lower_bound
#define   ubd                               upper_bound
#define   si                                set<int>
#define   que_max                           priority_queue <int>
#define   que_min                           priority_queue <int, vi, greater<int> >
#define   mp                                make_pair
#define   umap                              unordered_map
#define   fastio                            ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   decimal(k)                        fixed<<setprecision(k)
#define   PI                                3.14159265359
#define   ff                                first
#define   ss                                second
#define   all(V)                            (V).begin(),(V).end()
#define   alla(a,n)                         a, a+n
#define   sz(v)                             (ll)v.size()
#define   szz(a,n)                          sizeof(a)/(n)
#define   SORT(v)                           sort(all(v))
#define   REV                               reverse
#define   MAX                               max_element
#define   MIN                               min_element
#define   UNIQUE(v)                         sort(all(v)); v.erase(unique(v.begin(),v.end()),v.end())
#define   mem1(a)                           memset(a,-1,sizeof(a));
#define   mem0(a)                           memset(a,0,sizeof(a));
#define   mymax                             1000000000000000100
#define   mymin                             -1000000001
#define   bitcount                          __builtin_popcount
#define   gcd                               __gcd
#define   MOD                               (ll)1000000007
#define   INF                               2147483646
#define   TEST(t)                           int tc; cin>>tc; fo(t,1,tc+1)
#define   TS                                to_string
#define   len(s)                            (s).length()
#define   line                              cout << '\n';
#define   endl                              '\n'
#define   open                              {
#define   close                             }
#define   goog(tno)                         cout <<"Case #" << tno << ": "
#define   np2(S)                            ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))

#ifndef   SEGMENTTREE_H
#define   SEGMENTTREE_H
#define   left(i) (2*i + 1)
#define   right(i) (2*i + 2)
#define   parent(i) ((i-1)/2)

using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds;

const int maxN = 9e7+1;
bool primebool[maxN];
const int gmax = 3e4+1;

vi g[gmax];
int vis[gmax];
int dist[gmax];

typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

template<class T>
class SegmentTree
{
    public:
        SegmentTree(std::vector<T> data, T value, T (*combine)(T obj1, T obj2));
        SegmentTree(T ar[], int n, T value, T (*combine)(T obj1, T obj2));
        T query(int l, int r);
        void update(int idx, T val);
    private:
        T *tree;
        void buildTree(std::vector<T> data);
        int segTreeSize;
        T valueForExtraNodes;
        T (*combine)(T obj1, T obj2);
        int calculateSize(int n);
        T queryHelper(int l,int r, int st, int ed, int node);
};

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

ll mod_add(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}
ll mod_mul(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
ll mod_sub(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a - b) % m) + m) % m;}



ll power(ll x,ll y,ll m){            //power(x,y)=x^y  %m;
    if(y==0)return 1;
    ll a=power(x,y/2,m);
    if(y%2){
        return (a*((a*x)%m))%m;
    }
    else{
        return (a*a)%m;
    }
}

ll power(ll x,ll y){            //power(x,y)=x^y  %m;
    if(y==0)return 1;
    ll a=power(x,y/2);
    if(y%2){
        return (a*((a*x)));
    }
    else{
        return (a*a);
    }
}

ll mod_inverse(ll x,ll m){
    return power(x,m-2,m);
}

ll fact(ll n){
    ll f = 1;
    for(ll i = n+1;--i;)
    {
        f = f*i;
    }
    return f;
}

ll factmod(ll n, ll m)
{
    ll f = 1;
    for(ll i = n+1;--i;)
    {
        f = ((f%m)*(i%m))%m;
    }
    return f;
}

ll ncr(ll n, ll r) {
    if(r > n - r) r = n - r;
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}

int isPal(string s){
    int len=s.size();
    int flag=1;
    for(int i=0;i<len;++i){
        if(s[i]!=s[len-i-1]){
            flag=0;
            break;
        }
    }
    return flag;
}

ll isPrime(ll n)
{
    if(n < 2)
        return 0;
    for(ll i = 2; i*i <= n; i++)
        if(n%i == 0)
            return 0;
    return 1;
}


ll sumD(ll n)
{
    if(n == 0)
        return 0;
    return (n%10) + sumD(n/10);
}

vLL pfactor(ll n)
{
    vLL v;
    while (n % 2 == 0)
    {
        v.pb(2);
        n = n/2;
    }
    for (ll i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            v.pb(i);
            n = n/i;
        }
    }
    if (n > 2)
        v.pb(n);
    return v;
}

string stringsort(string &s)
{
    string sr="";
    ll m[26] ={0};
    fo(i,0,len(s)-1)
        m[s[i]-'a']++;
    fo(i,0,25)
        while(m[i]--)
            sr += (char)(i+'a');
    return sr;
}

void arrinp(int *a, int n)
{
    fo(i,0,n)
        cin >> a[i];
}
void arrinp(ll *a, int n)
{
    fo(i,0,n)
        cin >> a[i];
}
ll asum(int *a, int st, int ed)
{
    ll sum = 0;
    fo(i,st,ed)
        sum += a[i];
    return sum;
}

ll vsum(vi &a, int st, int ed)
{
    ll sum = 0;
    fo(i,st,ed)
        sum += a[i];
    return sum;
}

int agcd(int *arr, int st, int ed)
{
    int result = arr[st];
    for (int i = st+1; i <ed; i++)
    {
        result = gcd(arr[i], result);

        if(result == 1)
        {
           return 1;
        }
    }
    return result;
}

ll alcm(int *arr, int st, int ed)
{
    ll ans = arr[st];


    for (int i = st+1; i <ed; i++)
        ans = (((arr[i] * ans)) /
                (gcd((ll)arr[i], ans)));

    return ans;
}
int vgcd(vi &arr, int st, int ed)
{
    int result = arr[st];
    for (int i = st+1; i <ed; i++)
    {
        result = gcd(arr[i], result);

        if(result == 1)
        {
           return 1;
        }
    }
    return result;
}
ll vlcm(vLL &arr, int st, int ed)
{
    ll ans = arr[st];


    for (int i = st+1; i <ed; i++)
        ans = (((arr[i] * ans)) /
                (gcd((ll)arr[i], ans)));

    return ans;
}

double median(int a[], int n)
{
    if (n % 2 != 0)
        return (double)a[n / 2];
 
    return (double)(a[(n - 1) / 2] + a[n / 2]) / 2.0;
}

vLL divisor(ll n)
{
    vLL v;
    for (int i = 1; i*i < n; i++) {
        if (n % i == 0)
            v.pb(i);
    }
    for (int i = sqrt(n); i >= 1; i--) {
        if (n % i == 0)
            v.pb(n / i);
    }
    return v;

}

vLL divpair(ll n)
{
    vLL v;
    for (int i=1; i<=sqrt(n); i++)
    {
        if (n%i == 0)
        {
            if (n/i == i)
                v.pb(i);

            else
                v.pb(i), v.pb(n/i);
        }
    }
    return v;
}

int mostfreq(int *arr, int n)
{
    unordered_map<int, int> hash;
    for (int i = 0; i < n; i++)
        hash[arr[i]]++;

    int max_count = 0, res = -1;
    for (auto &i : hash) {
        if (max_count <= i.second) {
            res = i.first;
            max_count = i.second;
        }
    }

    return res;
}

ll mostfreq(vLL &arr)
{
    int n = sz(arr);
    unordered_map<ll, ll> hash;
    for (int i = 0; i < n; i++)
        hash[arr[i]]++;

    ll max_count = 0, res = -1;
    for (auto &i : hash) {
        if (max_count <= i.second) {
            res = i.first;
            max_count = i.second;
        }
    }

    return res;
}

ll kadane(int *a, int n)
{
    ll ans=0,curr=0;
    for(int i=0;i<n;i++)
    {
        curr= curr+a[i];
        curr = max(0LL,curr);
        ans=max(ans,curr);
    }
    return ans;
}

vLL arrayIntersection(int *arr1, int *arr2, int m, int n)
{
    vLL v;
    int i = 0, j = 0;
    while (i < m && j < n) {
        if (arr1[i] < arr2[j])
            i++;
        else if (arr2[j] < arr1[i])
            j++;
        else
        {
            v.pb(arr2[j]);
            i++;
            j++;
        }
    }
    return v;
}

void leftRotate(int *arr, int d, int n)
{
    d = d % n;
    int g_c_d = gcd(d, n);
    for (int i = 0; i < g_c_d; i++) {
        int temp = arr[i];
        int j = i;

        while (1) {
            int k = j + d;
            if (k >= n)
                k = k - n;

            if (k == i)
                break;

            arr[j] = arr[k];
            j = k;
        }
        arr[j] = temp;
    }
}

void seive()
{
    for(int i = 2; i*i <= maxN; i++)
    {
        if(!primebool[i])
        {
            for(int j = i*i; j <= maxN; j+=i)
            {
                primebool[j] = true;
            }
        }
    }
}

vi z_algo(string &s)
{
    int n=s.size();
    vi z(n);
    for(int i=1,l=0,r=0;i<n;i++)
    {
        if(i<=r)
            z[i]=min(r-i+1, z[i-l]);
        while(i+z[i]<n && s[z[i]]==s[i+z[i]])
            z[i]++;
        if(i+z[i]-1>r)
            l=i, r=i+z[i]-1;
    }
    return z;
}

int phi(int n)
{
    int res = n;
    for(int i = 2; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            res/=i;
            res *= (i-1);
            while(n%i == 0)
                n/=i;
        }
    }
    if(n>1)
        res/=n, res *= (n-1);
    return res;
}

vi dectobin(int n)
{
    int l = floor(log2(n))+1;
    vi bin(l);
    rfo(i,l,0)
        bin[i] = (!!(n & (1 << i)));
    reverse(all(bin));
    return bin;
}

void creategraph(int n, int m)
{
    int a, b;
    for(int i = 1; i <= m; i++)
    cin >> a >> b, g[a].pb(b), g[b].pb(a);

}

void dfs(int node)
{
    vis[node] = 1;
    //cout << node << " ";  //to show bfs
    for(int child: g[node])
    if(!vis[child])
        dfs(child);
}

void bfs(int node)
{
    queue<int> q;
    q.push(node);
    vis[node] = 1;
    while(!q.empty())
    {
        int curr = q.front();
        //cout << curr << " ";  //to show bfs
        q.pop();
        for(int child: g[curr])
        {
            if(vis[child] == 0)
            {
                q.push(child);
                vis[child] = 1;
            }
        }
    }
}

int rrr(int a, int b) { return a + rand() % (b - a + 1); };
bool ispow2(ll n){ return (ceil(log2(n)) == floor(log2(n)))?1:0; }
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
void yes() { cout << "YES\n"; }
void no()  { cout << "NO\n"; }
void noi() { cout << "-1" << endl; }
bool notgate(ll n) { return not (n); }
string fileName(string s1,string s2) { return s1+=s2; }



/*===================================================================================================================================*/



int getSum(int *BITree, int index)
{
    int sum = 0;
    while (index > 0)
    {
        sum += BITree[index];
        index -= index & (-index);
    }
    return sum;
}

void updateBIT(int *BITree, int n, int index, int val)
{
    while (index <= n)
    {
    BITree[index] += val;

    index += index & (-index);
    }
}

void convert(int *arr, int n)
{
    int temp[n];
    for (int i=0; i<n; i++)
        temp[i] = arr[i];
    sort(temp, temp+n);
    for (int i=0; i<n; i++)
    {
        arr[i] = lower_bound(temp, temp+n, arr[i]) - temp + 1;
    }
}

int inversion(int *arr, int n)
{
    int invcount = 0;

    convert(arr, n);
    int BIT[n+1];
    for (int i=1; i<=n; i++)
        BIT[i] = 0;
    for (int i=n-1; i>=0; i--)
    {
        invcount += getSum(BIT, arr[i]-1);
        updateBIT(BIT, n, arr[i], 1);
    }

    return invcount;
}



template<class T> SegmentTree<T>::SegmentTree(std::vector<T> data,
                                                T value, T (*combine)(T obj1, T obj2))
{
   this->combine = combine;
   valueForExtraNodes = value;
   segTreeSize = calculateSize(data.size());
   buildTree(data);
}

template<class T> SegmentTree<T>::SegmentTree(T ar[], int n,
                                            T value, T (*combine)(T obj1, T obj2))
{
   this->combine = combine;
   valueForExtraNodes = value;
   segTreeSize = calculateSize(n);

   std::vector<T> data;
   for(int i = 0; i < n; i++)
         data.push_back(ar[i]);

   buildTree(data);
}


template<class T> int SegmentTree<T>::calculateSize(int n)
{
    int pow2 = 1;
    while( pow2 < n)
    {
        pow2 = pow2 << 1;
    }
    return 2*pow2 - 1;
}

template<class T> T SegmentTree<T>::query(int l, int r)
{
    int st = 0, ed = segTreeSize/2;
    return queryHelper(l, r, st, ed, 0);
}

template<class T> T SegmentTree<T>::queryHelper(int l,int r, int st, int ed, int node)
{
    if( (r < st) || (l > ed) || (l > r) )
        return valueForExtraNodes;
    if(st >= l && ed <= r)
        return tree[node];
    T leftVal = queryHelper(l, r, st, (st + ed)/2, left(node));
    T rightVal = queryHelper(l, r, (st+ed)/2 + 1, ed, right(node));
    return combine(leftVal, rightVal);
}

template<class T> void SegmentTree<T>::buildTree(std::vector<T> data)
{
   int n = data.size();
   tree = new T[segTreeSize];
   int extraNodes = (segTreeSize/2 + 1) - n;
   for(int i = segTreeSize - 1; i >= 0; i--)
   {
       if(extraNodes>0)
           {
               tree[i] = valueForExtraNodes;
               extraNodes--;
           }
       else if(n>0)
           {
               tree[i] = data[n-1];
               n--;
           }
       else
           tree[i] = combine(tree[left(i)], tree[right(i)]);
   }
}

template<class T> void SegmentTree<T>::update(int idx, T val)
{
    int segTreeIdx = (segTreeSize/2) + idx;
    tree[segTreeIdx] = val;
    while(parent(segTreeIdx) >= 0)
    {
        segTreeIdx = parent(segTreeIdx);
        if(right(segTreeIdx) < segTreeSize)
          tree[segTreeIdx] = combine(tree[left(segTreeIdx)], tree[right(segTreeIdx)]);
        if(segTreeIdx == 0)
            break;
    }
}

#endif // SEGMENTTREE_H

#ifndef ONLINE_JUDGE
    
    void showarr(int *a, int n)
    {
        debug(a);
        cout << "[ ";
        fo(i,0,n)
            cout << a[i] << " ";
        cout << "]";
        line;
    }
 
    void showarr(ll *a, int n)
    {
        debug(a);
        cout << "[ ";
        fo(i,0,n)
            cout << a[i] << " ";
        cout << "]";
        line;
    }
 
    void showvec(vi &v)
    {
        debug(v);
        cout << "[ ";
         for(auto &x:v)
            cout << x << " ";
        cout << "]";
         line;
    }
 
void showvec(vLL v)
{
    debug(v);
    cout << "[ ";
    for(auto &x:v)
        cout << x << " ";
    cout << "]";
    line;
}
#else
void showarr(int *a, int n){}
void showarr(ll *a, int n){}
void showvec(vi &v){}
void showvec(vLL v){}
 
#endif




/*====================================================================================================================*/
/****************************************{Code begins here}*************************************************************/
/*===================================================================================================================*/
ll l,r;
ll a[(cint)1e6+1];
ll n = (cint)1e6;
ll psum[(cint)1e6+1];
void lucky()
{
    a[1] = 4;
    a[2] = 7;
    psum[1] = 4;
    psum[2] = 11;
    fo(i,3,n)
    {
        if(i%2)
            a[i] = a[i/2]*10+4;
        else
            a[i] = a[i/2-1]*10+7;
        //trace(a[i]);
        psum[i] = psum[i-1]+a[i];
        //trace(psum[i]);

    }
}

void solve_Tarbi()
{
    
	ll l,r;
    cin>>l>>r;
    //lucky(0);
    lucky();
    ll i1 = lbd(a+1,a+n+1,l)-(a+1), i2 = ubd(a+1,a+n+1,r)-(a+1);
    cout << *lbd(a+1,a+n+1,l);
    cout << *ubd(a+1,a+n+1,r);
    trace(i1,i2);
    cout << psum[i2] << " " << psum[i1-1];





}



int main()
{
    fastio;
    #ifndef ONLINE_JUDGE
        string directory = "/home/bibhash/Desktop/in-out/";
        string inputfile = "input.txt";
        string outputfile = "output.txt";
        freopen(fileName(directory,inputfile).c_str(), "r", stdin);
        freopen(fileName(directory,outputfile).c_str(),"w", stdout);
    #endif
    
    //TEST(tcc)
    solve_Tarbi();
    return 0;


}

/*=================================================================================={Author: Bibhash Ghosh (Tarbi)}===*/