Problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Petya and his friend Vasya play an interesting game. Petya randomly chooses an integer p from the interval [pl, pr] and Vasya chooses an integer v from the interval [vl, vr] (also randomly). Both players choose their integers equiprobably. Find the probability that the interval [min(v, p), max(v, p)] contains exactly k lucky numbers.

Input

The single line contains five integers pl, pr, vl, vr and k (1 ≤ pl ≤ pr ≤ 109, 1 ≤ vl ≤ vr ≤ 109, 1 ≤ k ≤ 1000).

Output

On the single line print the result with an absolute error of no more than 10 - 9.

Examples

Input

1 10 1 10 2


Output

0.320000000000


Input

5 6 8 10 1


Output

1.000000000000

Note

Consider that [a, b] denotes an interval of integers; this interval includes the boundaries. That is, <image>

In first case there are 32 suitable pairs: (1, 7), (1, 8), (1, 9), (1, 10), (2, 7), (2, 8), (2, 9), (2, 10), (3, 7), (3, 8), (3, 9), (3, 10), (4, 7), (4, 8), (4, 9), (4, 10), (7, 1), (7, 2), (7, 3), (7, 4), (8, 1), (8, 2), (8, 3), (8, 4), (9, 1), (9, 2), (9, 3), (9, 4), (10, 1), (10, 2), (10, 3), (10, 4). Total number of possible pairs is 10·10 = 100, so answer is 32 / 100.

In second case Petya always get number less than Vasya and the only lucky 7 is between this numbers, so there will be always 1 lucky number.

Solution (in JAVA):

Solution:
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.Vector;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Queue;
import java.util.LinkedList;
import java.math.BigInteger;
import java.util.Collection;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author bkand1908
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long pLeft = in.readLong();
        long pRight = in.readLong();
        long vLeft = in.readLong();
        long vRight = in.readLong();
        long k = in.readLong();

        long[] lucky = generateLucky();
        long total = (pRight - pLeft + 1) * (vRight - vLeft + 1);

        long sum = 0, sumInsect = 0;

        for (int i = 0; i < 2; ++i) {
            long pPre = Math.max(pRight, vRight);
            int ip = lucky.length - 1;
            while (ip >= 0) {
                while (ip >= 0 && lucky[ip] > pPre) --ip;
                if (ip < 0) break;
                int iv = (int) (ip + k - 1);
                if (iv < lucky.length) {
                    long lowP;
                    if (ip == 0 || pLeft > lucky[ip - 1]) lowP = pLeft;
                    else lowP = lucky[ip - 1] + 1;
                    long highP = Math.min(lucky[ip], pRight);
                    long lowV = Math.max(lucky[iv], vLeft);
                    long highV = Math.min(lucky[iv + 1] - 1, vRight);
                    if (lowP <= highP && lowV <= highV) {
                        sum += (highP - lowP + 1) * (highV - lowV + 1);
                    }
                }
                pPre = lucky[ip] - 1;
            }
            long temp = pLeft; pLeft = vLeft; vLeft = temp;
            temp = pRight; pRight = vRight; vRight = temp;
        }

        long start = -1, end = -1;
        if (pRight >= vLeft && pLeft <= vRight && k == 1) {
            start = Math.max(pLeft, vLeft);
            end = Math.min(pRight, vRight);
            for (int i = 0; i < lucky.length && lucky[i] <= end; ++i)
                if (lucky[i] >= start) ++sumInsect;
        }
        out.println((double) (sum - sumInsect) / total);
    }

    private long[] generateLucky() {
        Vector<Long> v = new Vector<Long>();
        Queue<Long> q = new LinkedList<Long>();
        q.add(4l);
        q.add(7l);
        while (!q.isEmpty()) {
            long value = q.remove();
            if (value > 10000000000l) continue;
            v.add(value);
            q.add(value * 10 + 4);
            q.add(value * 10 + 7);
        }
        long[] ans = new long[v.size()];
        for (int i = 0; i < ans.length; ++i)
            ans[i] = v.elementAt(i);
        return ans;
    }
}

class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
                this.stream = stream;
        }

        public int read() {
                if (numChars == -1)
                        throw new InputMismatchException();
                if (curChar >= numChars) {
                        curChar = 0;
                        try {
                                numChars = stream.read(buf);
                        } catch (IOException e) {
                                throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                                return -1;
                }
                return buf[curChar++];
        }

        public long readLong() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                long res = 0;
                do {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        private boolean isSpaceChar(int c) {
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        }