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.*;
		
public class Main {

		final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null;
		private BufferedReader input;
		private PrintWriter output;
		private StringTokenizer stoken;
		
		String fin = "input";
		String fout = "output";


		private void solve() {

/*
			int n = nextInt();
			
			boolean key = false;
			for (int i=n; i>0; i--) {
				if (n % i == 0) {
					String st = String.valueOf(i);
					if (
							(st.indexOf("0") > -1) ||
							(st.indexOf("1") > -1) ||
							(st.indexOf("2") > -1) ||
							(st.indexOf("3") > -1) ||
							(st.indexOf("5") > -1) ||
							(st.indexOf("6") > -1) ||
							(st.indexOf("8") > -1) ||
							(st.indexOf("9") > -1) ||
							(st.indexOf("0") > -1)
						) {
						key = false;
					} else {
						key = true;
						break;
					}
				}
			}
			
			if (key) {
				output.print("YES");
			} else {
				output.print("NO");
			}
*/
			
			/*
			String st = nextToken();
			int count4 = 0;
			int count7 = 0;
			
			for (int i=0; i<st.length(); i++) {
				if (st.charAt(i) == '4') count4++;
				if (st.charAt(i) == '7') count7++;
			}
			
			if (count4 == 0 && count7 == 0) {
				output.print(-1);
			} else {
				if (count4 >= count7) {
					output.print(4);
				} else {
					output.print(7);
				}
			}
			*/
			
			
			int l = nextInt();
			int r = nextInt();
			
			ArrayList<Long> arr = new ArrayList<Long>();
			arr.add(4L);
			arr.add(7L);
			
			long k = 7;
			int level = 0;
			int levelCount = 2;
			int pow = 0;
			int levelFrom = 0;
			while (k < 1000000000) {
				long dec = 10;
				for (int i=0; i<level; i++) {
					dec = dec *10;
				}
				for (int i=0; i<levelCount; i++) {
					k = 4*dec + arr.get(levelFrom+i);
					arr.add(k);
				}
				for (int i=0; i<levelCount; i++) {
					k = 7*dec + arr.get(levelFrom+i);
					arr.add(k);
				}
				level++;
				levelCount *= 2;
				pow = (int) Math.pow(2, level);
				levelFrom = levelFrom + pow;
			}
			
			
			int curIndex = 0;
			while (arr.get(curIndex) < l) {
				curIndex++;
			}
			
			long res = 0;
			/*
			for (int i=l; i<=r; i++) {
				if (i > arr.get(curIndex)) {
					curIndex++;
				}
				res += arr.get(curIndex);
			}
			*/
			
			long i = l;
			while (i <= r) {
				long count = Math.min(arr.get(curIndex), r) - i + 1;
				long cur = count * arr.get(curIndex);
				res = res + cur;
				i = arr.get(curIndex)+1;
				curIndex++;
			}
			output.print(res);
			
			
		}

		
		


		Main() throws IOException {
				//input = new BufferedReader(new InputStreamReader(System.in));
				//output = new PrintWriter(System.out);
				
				if (ONLINE_JUDGE){
					//input = new BufferedReader(new FileReader(fin + ".txt"));
					//output = new PrintWriter(System.out);
				} else {
					//input = new BufferedReader(new InputStreamReader(System.in));
					//output = new PrintWriter(System.out);
				}			

				//input = new BufferedReader(new FileReader(fin + ".txt"));
				input = new BufferedReader(new InputStreamReader(System.in));
				output = new PrintWriter(System.out);
				
				
				solve();

				
				input.close();
				output.flush();
				output.close();
		}

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

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

		double nextFloat() {
				return Float.parseFloat(nextToken());
		}

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

		String nextToken() {
				while ((stoken == null) || (!stoken.hasMoreTokens())) {
						try {
								String line = input.readLine();
								stoken = new StringTokenizer(line);
						} catch (IOException e) {
								e.printStackTrace();
						}
				}
				return stoken.nextToken();
		}
		

    
		public static void main(String[] args) throws IOException {
				new Main();
		}

}

