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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Queue;
import java.util.StringTokenizer;


public class luckysum {

	static ArrayList<Long> lucky;
	static int idx = 0 ;
	static int idx2 = 1;
	static int c1=1;
	static int c2 = 2;
	static int r ;
	
//	static ArrayList<Long> luckyNumbers = new ArrayList<Long>();
//	public static void generateLucky()
//	{
//		luckyNumbers.add((long) 4);
//		luckyNumbers.add((long) 7);
//		int prevSize = 0;
//		for (int i=2;i<10;i++)
//		{
//			int s = luckyNumbers.size();
//			for (int j=prevSize;j<s;j++)
//			{
//				long a = luckyNumbers.get(j);
//				a*=10;
//				luckyNumbers.add(a+4);
//				luckyNumbers.add(a+7);
//			}
//			prevSize = s;
//		}
//		luckyNumbers.add(Long.valueOf("4444444444"));
//	}
	public  static void addlucky(long a){
		//int sum =(int)(Math.ceil( Math.log((idx+1)-(idx2+1)) / Math.log(2)));
		
		int sum =0;
		long temp = a;
		while(temp > 0){
			sum++;
			temp /= 10;
		}
		//System.out.println(sum);
		
		long b =(long)( 4*Math.pow(10,sum));
	   // System.out.println(b);

		Long nexlucky = b + a;
		lucky.add(nexlucky);
		b =(long)(7*Math.pow(10,sum));
		//System.out.println(b);
		nexlucky = b + a;
	lucky.add(nexlucky);
//		if(idx2 == c2){
//			c1++;
//			c2 *= 2;
//			idx2 = 1;
//		}else{
//		idx2++;
//		}
	}
	public static void luckies(){
		
//		//int thislucky  = lucky.get(idx);
//		if(r <= thislucky || thislucky >= 1000000000)
//			return;
//		addlucky(thislucky);
//		idx++;
//		luckies();
		int i = 0;
		while(i<=2046){
			long thislucky  = lucky.get(idx);
			if(r <= thislucky )
				return;
			addlucky(thislucky);
			idx++;
		}

	}
	
public static void main(String[] args) throws IOException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long l = sc.nextInt();
        r = sc.nextInt();
		lucky = new ArrayList<Long>();
		lucky.add((long)(4));
		lucky.add((long)7);
		luckies();
		Collections.sort(lucky);
		//generateLucky();
	  // System.out.println(lucky.toString());
		long sum = 0; 
		

		for (long x:lucky) {
			if(x >= l){
			 sum += x*(Math.min(x-l+1, r-l+1));
			 l = Math.min(r, x) +1;
			}
		}
        out.println(sum);
	    out.flush();
	    out.close();
		
		
	}
	
	
	
	static class Scanner 
	{
		StringTokenizer st;
		BufferedReader br;
 
		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
 
		public String next() throws IOException 
		{
			while (st == null || !st.hasMoreTokens()) 
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public int nextInt() throws IOException {return Integer.parseInt(next());}
 
		public long nextLong() throws IOException {return Long.parseLong(next());}
 
		public String nextLine() throws IOException {return br.readLine();}
 
		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}
 
		public boolean ready() throws IOException {return br.ready();}
	}
}