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.

Input

The single line contains two integers l and r (1 ≤ l ≤ r ≤ 109) — the left and right interval limits.

Output

In the single line print the only number — the sum next(l) + next(l + 1) + ... + next(r - 1) + next(r).

Please do not use the %lld specificator to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specificator.

Examples

Input

2 7


Output

33


Input

7 7


Output

7

Note

In the first sample: next(2) + next(3) + next(4) + next(5) + next(6) + next(7) = 4 + 4 + 4 + 7 + 7 + 7 = 33

In the second sample: next(7) = 7
import java.io.*;
import java.math.BigInteger;
import java.util.*;

/**
 * @author kgs
 */
public class C {

    private ArrayList<Long> lucky = new ArrayList<Long>();

    private void solve() throws IOException {
        long l = nextLong();
        long r = nextLong();
        generateLucky();

        long res = 0;
        int luckyPos = findLucky(l);

        while (l <= r) {
            long diff = lucky.get(luckyPos) - l + 1;
            if (l + diff > r) {
                diff = r - l + 1;
            }
            res += diff * lucky.get(luckyPos);
//            System.out.println("diff=" + diff + ", lucky=" + lucky.get(luckyPos));
            l += diff;
            luckyPos++;
        }

        out.println(res);
    }

    private int findLucky(long l) {
        int i = 0;
        while (lucky.get(i) < l) {
            i++;
        }
        return i;
    }

    private void generateLucky() {
        for (int i = 1; i <= 9; i++) {
            generateLen(i);
        }
        lucky.add(4444444444L);
    }

    private void generateLen(int l) {
//        System.out.println("len=" + l);
        for (int i = 0; i < (1 << l); i++) {
//            System.out.println(i);
            StringBuilder s = new StringBuilder();
            for (int b = l - 1; b >= 0; b--) {
                if (((1 << b) & i) != 0) {
                    s.append('7');
                } else {
                    s.append('4');
                }
            }
            //System.out.println(s.toString());
            lucky.add(Long.valueOf(s.toString()));
        }
    }

    // ----------------- HELPER ROUTINES ------------------

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer strTok;

    private String nextLine() throws IOException {
        return in.readLine();
    }

    private String nextToken() throws IOException {
        while (strTok == null || !strTok.hasMoreTokens()) {
            String line = nextLine();
            if (line != null) {
                strTok = new StringTokenizer(line);
            } else {
                return null;
            }
        }
        return strTok.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private BigInteger nextBig() throws IOException {
        return new BigInteger(nextToken());
    }

    public static void main(String[] args) {
        new C().run();
    }

    private long getMemory() {
        return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024;
    }

    private void run() {
        Locale.setDefault(Locale.US);
        try {
            boolean onlineJudge = System.getProperty("ONLINE_JUDGE") != null;
            if (!onlineJudge) {
                in = new BufferedReader(new FileReader("src/input.txt"));
                out = new PrintWriter("src/output.txt");
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            long startMem = getMemory();
            long startTime = System.currentTimeMillis();
            solve();
            long endTime = System.currentTimeMillis();
            long endMem = getMemory();
            if (!onlineJudge) {
                System.out.println("Running time = " + (endTime - startTime) + "ms");
                System.out.println("Memory used = " + (endMem - startMem) + "MB");
                System.out.println("Total memory = " + getMemory() + "MB");
            }
            in.close();
            out.close();
        } catch (Throwable t) {
            t.printStackTrace();
            System.exit(1);
        }
    }

}
