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.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.InputStream;

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

class TaskD {

    long intersect(long a, long b, int c, int d) {
        long lmin = Math.max(a, c);
        long lmax = Math.min(b, d);
        if(lmin > lmax) return 0;
        else return lmax - lmin + 1;
    }
    public void solve(int testNumber, InReader in, OutputWriter out) {
        int a = in.readInt();
        int b = in.readInt();
        int c = in.readInt();
        int d = in.readInt();
        int k = in.readInt();
        long[] allLucky = new long[100000];
        allLucky[0] = 0;
        int luckyCount = 0;
        for (int length = 1; length < 11; length++) {
            int mask = 1 << length;
            for (int i = 0; i < mask; i++) {
                //works in reverse but shouldn't afffect functionality
                long num = 0;
                int lmask = i;
                int bits = length;
                while (bits > 0) {
                    if ((lmask & 1) == 1) num = num * 10 + 7;
                    else num = num * 10 + 4;
                    lmask >>= 1;
                    bits --;
                }
                allLucky[++luckyCount] = num;
            }
        }
        allLucky[++luckyCount] = (long)1e9;
        Arrays.sort(allLucky, 0, luckyCount);
        //System.out.println(luckyCount);
        //System.out.println(Arrays.toString(allLucky));
        long total = 0;
        long tries = ((long)(b - a + 1)) * (d - c + 1);
        //System.out.println(tries);
        for (int i = 1; i + k < luckyCount; i++) {
            int st = i;
            int end = i + k - 1;
            long frst = intersect(allLucky[st - 1] + 1, allLucky[st], a, b) * intersect(allLucky[end], allLucky[end + 1] - 1, c, d);
            long sec = intersect(allLucky[st - 1] + 1, allLucky[st], c, d) * intersect(allLucky[end], allLucky[end + 1] - 1, a, b);

            total += frst + sec;
            int lmin = Math.max(a,  c);
            int lmax = Math.min(b, d);
            if(frst + sec > 0 && k == 1 && intersect(a, b, c, d) > 0) total -= 1;
            //total -= ( intersect(allLucky[end], allLucky[end + 1], lmin, lmax) ) * ( intersect(1, allLucky[st], lmin, lmax) );

        }

        out.printf("%.12f",total * 1.0 / tries);
    }
}

class InReader {

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

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

    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;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}


    public void printf(String format, Object...args) {
        writer.printf(format,args);
    }

	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}

}