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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void initlucky();
class oPair {
 public:
  long a, b;
  long long Diff() {
    if (a == b && a == -1)
      return 0;
    else
      return (long long)(b - a + 1);
  }
  bool Contain(long n) { return (n >= a && n <= b); }
};
oPair Intersect(oPair x, oPair y) {
  oPair res;
  res.a = max(x.a, y.a);
  res.b = min(x.b, y.b);
  if (res.a > res.b) res.a = res.b = -1;
  return res;
}
oPair Bound(oPair x, oPair y) {
  oPair res;
  res.a = min(x.a, y.a);
  res.b = max(x.b, y.b);
  return res;
}
bool Equals(oPair x, oPair y) { return (x.a == y.a && x.b == y.b); }
oPair p1, p2;
long c, totallucky, lucky[1023];
void input(long &n) { scanf("%ld", &n); }
void input(oPair &p1, oPair &p2, long &c) {
  input(p1.a);
  input(p1.b);
  input(p2.a);
  input(p2.b);
  input(c);
}
void GetLuckyList(oPair p, long a[], long &cnt) {
  cnt = 0;
  for (long i = 1; i <= totallucky; i++) {
    if (p.Contain(lucky[i])) a[cnt++] = lucky[i];
  }
}
long long NumOfChoices(long left, long right, oPair pp) {
  oPair p;
  p.a = left;
  p.b = right;
  p = Intersect(p, pp);
  return p.Diff();
}
long long calcNumOfCases(oPair p1, oPair p2, long leftLimit, long left,
                         long right, long rightLimit) {
  long long res = 0;
  long long tmp1 = NumOfChoices(leftLimit + 1, left, p1);
  long long tmp2 = NumOfChoices(right, rightLimit - 1, p2);
  res += tmp1 * tmp2;
  tmp1 = NumOfChoices(leftLimit + 1, left, p2);
  tmp2 = NumOfChoices(right, rightLimit - 1, p1);
  res += tmp1 * tmp2;
  return res;
}
long lstNums[1023];
double solve(oPair p1, oPair p2, long c) {
  oPair pInt = Bound(p1, p2);
  oPair pLap = Intersect(p1, p2);
  long long totalcases = p1.Diff() * p2.Diff();
  long long numofcases = 0;
  long luckCount;
  GetLuckyList(pInt, lstNums, luckCount);
  sort(lstNums, lstNums + luckCount);
  for (long left = 0; left < luckCount; left++) {
    long right = left + c - 1;
    if (right >= luckCount) break;
    numofcases += calcNumOfCases(
        p1, p2, (left <= 0 ? -1 : lstNums[left - 1]), lstNums[left],
        lstNums[right],
        right >= luckCount - 1 ? 2000000000 : lstNums[right + 1]);
    if (c == 1 && pLap.Contain(lstNums[left])) numofcases--;
  }
  return (double)numofcases / totalcases;
}
void output(double res) { printf("%.12llf", res); }
int main() {
  initlucky();
  input(p1, p2, c);
  double res = solve(p1, p2, c);
  output(res);
}
void initlucky() {
  lucky[1] = 4;
  lucky[2] = 44;
  lucky[3] = 444;
  lucky[4] = 4444;
  lucky[5] = 44444;
  lucky[6] = 444444;
  lucky[7] = 4444444;
  lucky[8] = 44444444;
  lucky[9] = 444444444;
  lucky[10] = 444444447;
  lucky[11] = 44444447;
  lucky[12] = 444444474;
  lucky[13] = 444444477;
  lucky[14] = 4444447;
  lucky[15] = 44444474;
  lucky[16] = 444444744;
  lucky[17] = 444444747;
  lucky[18] = 44444477;
  lucky[19] = 444444774;
  lucky[20] = 444444777;
  lucky[21] = 444447;
  lucky[22] = 4444474;
  lucky[23] = 44444744;
  lucky[24] = 444447444;
  lucky[25] = 444447447;
  lucky[26] = 44444747;
  lucky[27] = 444447474;
  lucky[28] = 444447477;
  lucky[29] = 4444477;
  lucky[30] = 44444774;
  lucky[31] = 444447744;
  lucky[32] = 444447747;
  lucky[33] = 44444777;
  lucky[34] = 444447774;
  lucky[35] = 444447777;
  lucky[36] = 44447;
  lucky[37] = 444474;
  lucky[38] = 4444744;
  lucky[39] = 44447444;
  lucky[40] = 444474444;
  lucky[41] = 444474447;
  lucky[42] = 44447447;
  lucky[43] = 444474474;
  lucky[44] = 444474477;
  lucky[45] = 4444747;
  lucky[46] = 44447474;
  lucky[47] = 444474744;
  lucky[48] = 444474747;
  lucky[49] = 44447477;
  lucky[50] = 444474774;
  lucky[51] = 444474777;
  lucky[52] = 444477;
  lucky[53] = 4444774;
  lucky[54] = 44447744;
  lucky[55] = 444477444;
  lucky[56] = 444477447;
  lucky[57] = 44447747;
  lucky[58] = 444477474;
  lucky[59] = 444477477;
  lucky[60] = 4444777;
  lucky[61] = 44447774;
  lucky[62] = 444477744;
  lucky[63] = 444477747;
  lucky[64] = 44447777;
  lucky[65] = 444477774;
  lucky[66] = 444477777;
  lucky[67] = 4447;
  lucky[68] = 44474;
  lucky[69] = 444744;
  lucky[70] = 4447444;
  lucky[71] = 44474444;
  lucky[72] = 444744444;
  lucky[73] = 444744447;
  lucky[74] = 44474447;
  lucky[75] = 444744474;
  lucky[76] = 444744477;
  lucky[77] = 4447447;
  lucky[78] = 44474474;
  lucky[79] = 444744744;
  lucky[80] = 444744747;
  lucky[81] = 44474477;
  lucky[82] = 444744774;
  lucky[83] = 444744777;
  lucky[84] = 444747;
  lucky[85] = 4447474;
  lucky[86] = 44474744;
  lucky[87] = 444747444;
  lucky[88] = 444747447;
  lucky[89] = 44474747;
  lucky[90] = 444747474;
  lucky[91] = 444747477;
  lucky[92] = 4447477;
  lucky[93] = 44474774;
  lucky[94] = 444747744;
  lucky[95] = 444747747;
  lucky[96] = 44474777;
  lucky[97] = 444747774;
  lucky[98] = 444747777;
  lucky[99] = 44477;
  lucky[100] = 444774;
  lucky[101] = 4447744;
  lucky[102] = 44477444;
  lucky[103] = 444774444;
  lucky[104] = 444774447;
  lucky[105] = 44477447;
  lucky[106] = 444774474;
  lucky[107] = 444774477;
  lucky[108] = 4447747;
  lucky[109] = 44477474;
  lucky[110] = 444774744;
  lucky[111] = 444774747;
  lucky[112] = 44477477;
  lucky[113] = 444774774;
  lucky[114] = 444774777;
  lucky[115] = 444777;
  lucky[116] = 4447774;
  lucky[117] = 44477744;
  lucky[118] = 444777444;
  lucky[119] = 444777447;
  lucky[120] = 44477747;
  lucky[121] = 444777474;
  lucky[122] = 444777477;
  lucky[123] = 4447777;
  lucky[124] = 44477774;
  lucky[125] = 444777744;
  lucky[126] = 444777747;
  lucky[127] = 44477777;
  lucky[128] = 444777774;
  lucky[129] = 444777777;
  lucky[130] = 447;
  lucky[131] = 4474;
  lucky[132] = 44744;
  lucky[133] = 447444;
  lucky[134] = 4474444;
  lucky[135] = 44744444;
  lucky[136] = 447444444;
  lucky[137] = 447444447;
  lucky[138] = 44744447;
  lucky[139] = 447444474;
  lucky[140] = 447444477;
  lucky[141] = 4474447;
  lucky[142] = 44744474;
  lucky[143] = 447444744;
  lucky[144] = 447444747;
  lucky[145] = 44744477;
  lucky[146] = 447444774;
  lucky[147] = 447444777;
  lucky[148] = 447447;
  lucky[149] = 4474474;
  lucky[150] = 44744744;
  lucky[151] = 447447444;
  lucky[152] = 447447447;
  lucky[153] = 44744747;
  lucky[154] = 447447474;
  lucky[155] = 447447477;
  lucky[156] = 4474477;
  lucky[157] = 44744774;
  lucky[158] = 447447744;
  lucky[159] = 447447747;
  lucky[160] = 44744777;
  lucky[161] = 447447774;
  lucky[162] = 447447777;
  lucky[163] = 44747;
  lucky[164] = 447474;
  lucky[165] = 4474744;
  lucky[166] = 44747444;
  lucky[167] = 447474444;
  lucky[168] = 447474447;
  lucky[169] = 44747447;
  lucky[170] = 447474474;
  lucky[171] = 447474477;
  lucky[172] = 4474747;
  lucky[173] = 44747474;
  lucky[174] = 447474744;
  lucky[175] = 447474747;
  lucky[176] = 44747477;
  lucky[177] = 447474774;
  lucky[178] = 447474777;
  lucky[179] = 447477;
  lucky[180] = 4474774;
  lucky[181] = 44747744;
  lucky[182] = 447477444;
  lucky[183] = 447477447;
  lucky[184] = 44747747;
  lucky[185] = 447477474;
  lucky[186] = 447477477;
  lucky[187] = 4474777;
  lucky[188] = 44747774;
  lucky[189] = 447477744;
  lucky[190] = 447477747;
  lucky[191] = 44747777;
  lucky[192] = 447477774;
  lucky[193] = 447477777;
  lucky[194] = 4477;
  lucky[195] = 44774;
  lucky[196] = 447744;
  lucky[197] = 4477444;
  lucky[198] = 44774444;
  lucky[199] = 447744444;
  lucky[200] = 447744447;
  lucky[201] = 44774447;
  lucky[202] = 447744474;
  lucky[203] = 447744477;
  lucky[204] = 4477447;
  lucky[205] = 44774474;
  lucky[206] = 447744744;
  lucky[207] = 447744747;
  lucky[208] = 44774477;
  lucky[209] = 447744774;
  lucky[210] = 447744777;
  lucky[211] = 447747;
  lucky[212] = 4477474;
  lucky[213] = 44774744;
  lucky[214] = 447747444;
  lucky[215] = 447747447;
  lucky[216] = 44774747;
  lucky[217] = 447747474;
  lucky[218] = 447747477;
  lucky[219] = 4477477;
  lucky[220] = 44774774;
  lucky[221] = 447747744;
  lucky[222] = 447747747;
  lucky[223] = 44774777;
  lucky[224] = 447747774;
  lucky[225] = 447747777;
  lucky[226] = 44777;
  lucky[227] = 447774;
  lucky[228] = 4477744;
  lucky[229] = 44777444;
  lucky[230] = 447774444;
  lucky[231] = 447774447;
  lucky[232] = 44777447;
  lucky[233] = 447774474;
  lucky[234] = 447774477;
  lucky[235] = 4477747;
  lucky[236] = 44777474;
  lucky[237] = 447774744;
  lucky[238] = 447774747;
  lucky[239] = 44777477;
  lucky[240] = 447774774;
  lucky[241] = 447774777;
  lucky[242] = 447777;
  lucky[243] = 4477774;
  lucky[244] = 44777744;
  lucky[245] = 447777444;
  lucky[246] = 447777447;
  lucky[247] = 44777747;
  lucky[248] = 447777474;
  lucky[249] = 447777477;
  lucky[250] = 4477777;
  lucky[251] = 44777774;
  lucky[252] = 447777744;
  lucky[253] = 447777747;
  lucky[254] = 44777777;
  lucky[255] = 447777774;
  lucky[256] = 447777777;
  lucky[257] = 47;
  lucky[258] = 474;
  lucky[259] = 4744;
  lucky[260] = 47444;
  lucky[261] = 474444;
  lucky[262] = 4744444;
  lucky[263] = 47444444;
  lucky[264] = 474444444;
  lucky[265] = 474444447;
  lucky[266] = 47444447;
  lucky[267] = 474444474;
  lucky[268] = 474444477;
  lucky[269] = 4744447;
  lucky[270] = 47444474;
  lucky[271] = 474444744;
  lucky[272] = 474444747;
  lucky[273] = 47444477;
  lucky[274] = 474444774;
  lucky[275] = 474444777;
  lucky[276] = 474447;
  lucky[277] = 4744474;
  lucky[278] = 47444744;
  lucky[279] = 474447444;
  lucky[280] = 474447447;
  lucky[281] = 47444747;
  lucky[282] = 474447474;
  lucky[283] = 474447477;
  lucky[284] = 4744477;
  lucky[285] = 47444774;
  lucky[286] = 474447744;
  lucky[287] = 474447747;
  lucky[288] = 47444777;
  lucky[289] = 474447774;
  lucky[290] = 474447777;
  lucky[291] = 47447;
  lucky[292] = 474474;
  lucky[293] = 4744744;
  lucky[294] = 47447444;
  lucky[295] = 474474444;
  lucky[296] = 474474447;
  lucky[297] = 47447447;
  lucky[298] = 474474474;
  lucky[299] = 474474477;
  lucky[300] = 4744747;
  lucky[301] = 47447474;
  lucky[302] = 474474744;
  lucky[303] = 474474747;
  lucky[304] = 47447477;
  lucky[305] = 474474774;
  lucky[306] = 474474777;
  lucky[307] = 474477;
  lucky[308] = 4744774;
  lucky[309] = 47447744;
  lucky[310] = 474477444;
  lucky[311] = 474477447;
  lucky[312] = 47447747;
  lucky[313] = 474477474;
  lucky[314] = 474477477;
  lucky[315] = 4744777;
  lucky[316] = 47447774;
  lucky[317] = 474477744;
  lucky[318] = 474477747;
  lucky[319] = 47447777;
  lucky[320] = 474477774;
  lucky[321] = 474477777;
  lucky[322] = 4747;
  lucky[323] = 47474;
  lucky[324] = 474744;
  lucky[325] = 4747444;
  lucky[326] = 47474444;
  lucky[327] = 474744444;
  lucky[328] = 474744447;
  lucky[329] = 47474447;
  lucky[330] = 474744474;
  lucky[331] = 474744477;
  lucky[332] = 4747447;
  lucky[333] = 47474474;
  lucky[334] = 474744744;
  lucky[335] = 474744747;
  lucky[336] = 47474477;
  lucky[337] = 474744774;
  lucky[338] = 474744777;
  lucky[339] = 474747;
  lucky[340] = 4747474;
  lucky[341] = 47474744;
  lucky[342] = 474747444;
  lucky[343] = 474747447;
  lucky[344] = 47474747;
  lucky[345] = 474747474;
  lucky[346] = 474747477;
  lucky[347] = 4747477;
  lucky[348] = 47474774;
  lucky[349] = 474747744;
  lucky[350] = 474747747;
  lucky[351] = 47474777;
  lucky[352] = 474747774;
  lucky[353] = 474747777;
  lucky[354] = 47477;
  lucky[355] = 474774;
  lucky[356] = 4747744;
  lucky[357] = 47477444;
  lucky[358] = 474774444;
  lucky[359] = 474774447;
  lucky[360] = 47477447;
  lucky[361] = 474774474;
  lucky[362] = 474774477;
  lucky[363] = 4747747;
  lucky[364] = 47477474;
  lucky[365] = 474774744;
  lucky[366] = 474774747;
  lucky[367] = 47477477;
  lucky[368] = 474774774;
  lucky[369] = 474774777;
  lucky[370] = 474777;
  lucky[371] = 4747774;
  lucky[372] = 47477744;
  lucky[373] = 474777444;
  lucky[374] = 474777447;
  lucky[375] = 47477747;
  lucky[376] = 474777474;
  lucky[377] = 474777477;
  lucky[378] = 4747777;
  lucky[379] = 47477774;
  lucky[380] = 474777744;
  lucky[381] = 474777747;
  lucky[382] = 47477777;
  lucky[383] = 474777774;
  lucky[384] = 474777777;
  lucky[385] = 477;
  lucky[386] = 4774;
  lucky[387] = 47744;
  lucky[388] = 477444;
  lucky[389] = 4774444;
  lucky[390] = 47744444;
  lucky[391] = 477444444;
  lucky[392] = 477444447;
  lucky[393] = 47744447;
  lucky[394] = 477444474;
  lucky[395] = 477444477;
  lucky[396] = 4774447;
  lucky[397] = 47744474;
  lucky[398] = 477444744;
  lucky[399] = 477444747;
  lucky[400] = 47744477;
  lucky[401] = 477444774;
  lucky[402] = 477444777;
  lucky[403] = 477447;
  lucky[404] = 4774474;
  lucky[405] = 47744744;
  lucky[406] = 477447444;
  lucky[407] = 477447447;
  lucky[408] = 47744747;
  lucky[409] = 477447474;
  lucky[410] = 477447477;
  lucky[411] = 4774477;
  lucky[412] = 47744774;
  lucky[413] = 477447744;
  lucky[414] = 477447747;
  lucky[415] = 47744777;
  lucky[416] = 477447774;
  lucky[417] = 477447777;
  lucky[418] = 47747;
  lucky[419] = 477474;
  lucky[420] = 4774744;
  lucky[421] = 47747444;
  lucky[422] = 477474444;
  lucky[423] = 477474447;
  lucky[424] = 47747447;
  lucky[425] = 477474474;
  lucky[426] = 477474477;
  lucky[427] = 4774747;
  lucky[428] = 47747474;
  lucky[429] = 477474744;
  lucky[430] = 477474747;
  lucky[431] = 47747477;
  lucky[432] = 477474774;
  lucky[433] = 477474777;
  lucky[434] = 477477;
  lucky[435] = 4774774;
  lucky[436] = 47747744;
  lucky[437] = 477477444;
  lucky[438] = 477477447;
  lucky[439] = 47747747;
  lucky[440] = 477477474;
  lucky[441] = 477477477;
  lucky[442] = 4774777;
  lucky[443] = 47747774;
  lucky[444] = 477477744;
  lucky[445] = 477477747;
  lucky[446] = 47747777;
  lucky[447] = 477477774;
  lucky[448] = 477477777;
  lucky[449] = 4777;
  lucky[450] = 47774;
  lucky[451] = 477744;
  lucky[452] = 4777444;
  lucky[453] = 47774444;
  lucky[454] = 477744444;
  lucky[455] = 477744447;
  lucky[456] = 47774447;
  lucky[457] = 477744474;
  lucky[458] = 477744477;
  lucky[459] = 4777447;
  lucky[460] = 47774474;
  lucky[461] = 477744744;
  lucky[462] = 477744747;
  lucky[463] = 47774477;
  lucky[464] = 477744774;
  lucky[465] = 477744777;
  lucky[466] = 477747;
  lucky[467] = 4777474;
  lucky[468] = 47774744;
  lucky[469] = 477747444;
  lucky[470] = 477747447;
  lucky[471] = 47774747;
  lucky[472] = 477747474;
  lucky[473] = 477747477;
  lucky[474] = 4777477;
  lucky[475] = 47774774;
  lucky[476] = 477747744;
  lucky[477] = 477747747;
  lucky[478] = 47774777;
  lucky[479] = 477747774;
  lucky[480] = 477747777;
  lucky[481] = 47777;
  lucky[482] = 477774;
  lucky[483] = 4777744;
  lucky[484] = 47777444;
  lucky[485] = 477774444;
  lucky[486] = 477774447;
  lucky[487] = 47777447;
  lucky[488] = 477774474;
  lucky[489] = 477774477;
  lucky[490] = 4777747;
  lucky[491] = 47777474;
  lucky[492] = 477774744;
  lucky[493] = 477774747;
  lucky[494] = 47777477;
  lucky[495] = 477774774;
  lucky[496] = 477774777;
  lucky[497] = 477777;
  lucky[498] = 4777774;
  lucky[499] = 47777744;
  lucky[500] = 477777444;
  lucky[501] = 477777447;
  lucky[502] = 47777747;
  lucky[503] = 477777474;
  lucky[504] = 477777477;
  lucky[505] = 4777777;
  lucky[506] = 47777774;
  lucky[507] = 477777744;
  lucky[508] = 477777747;
  lucky[509] = 47777777;
  lucky[510] = 477777774;
  lucky[511] = 477777777;
  lucky[512] = 7;
  lucky[513] = 74;
  lucky[514] = 744;
  lucky[515] = 7444;
  lucky[516] = 74444;
  lucky[517] = 744444;
  lucky[518] = 7444444;
  lucky[519] = 74444444;
  lucky[520] = 744444444;
  lucky[521] = 744444447;
  lucky[522] = 74444447;
  lucky[523] = 744444474;
  lucky[524] = 744444477;
  lucky[525] = 7444447;
  lucky[526] = 74444474;
  lucky[527] = 744444744;
  lucky[528] = 744444747;
  lucky[529] = 74444477;
  lucky[530] = 744444774;
  lucky[531] = 744444777;
  lucky[532] = 744447;
  lucky[533] = 7444474;
  lucky[534] = 74444744;
  lucky[535] = 744447444;
  lucky[536] = 744447447;
  lucky[537] = 74444747;
  lucky[538] = 744447474;
  lucky[539] = 744447477;
  lucky[540] = 7444477;
  lucky[541] = 74444774;
  lucky[542] = 744447744;
  lucky[543] = 744447747;
  lucky[544] = 74444777;
  lucky[545] = 744447774;
  lucky[546] = 744447777;
  lucky[547] = 74447;
  lucky[548] = 744474;
  lucky[549] = 7444744;
  lucky[550] = 74447444;
  lucky[551] = 744474444;
  lucky[552] = 744474447;
  lucky[553] = 74447447;
  lucky[554] = 744474474;
  lucky[555] = 744474477;
  lucky[556] = 7444747;
  lucky[557] = 74447474;
  lucky[558] = 744474744;
  lucky[559] = 744474747;
  lucky[560] = 74447477;
  lucky[561] = 744474774;
  lucky[562] = 744474777;
  lucky[563] = 744477;
  lucky[564] = 7444774;
  lucky[565] = 74447744;
  lucky[566] = 744477444;
  lucky[567] = 744477447;
  lucky[568] = 74447747;
  lucky[569] = 744477474;
  lucky[570] = 744477477;
  lucky[571] = 7444777;
  lucky[572] = 74447774;
  lucky[573] = 744477744;
  lucky[574] = 744477747;
  lucky[575] = 74447777;
  lucky[576] = 744477774;
  lucky[577] = 744477777;
  lucky[578] = 7447;
  lucky[579] = 74474;
  lucky[580] = 744744;
  lucky[581] = 7447444;
  lucky[582] = 74474444;
  lucky[583] = 744744444;
  lucky[584] = 744744447;
  lucky[585] = 74474447;
  lucky[586] = 744744474;
  lucky[587] = 744744477;
  lucky[588] = 7447447;
  lucky[589] = 74474474;
  lucky[590] = 744744744;
  lucky[591] = 744744747;
  lucky[592] = 74474477;
  lucky[593] = 744744774;
  lucky[594] = 744744777;
  lucky[595] = 744747;
  lucky[596] = 7447474;
  lucky[597] = 74474744;
  lucky[598] = 744747444;
  lucky[599] = 744747447;
  lucky[600] = 74474747;
  lucky[601] = 744747474;
  lucky[602] = 744747477;
  lucky[603] = 7447477;
  lucky[604] = 74474774;
  lucky[605] = 744747744;
  lucky[606] = 744747747;
  lucky[607] = 74474777;
  lucky[608] = 744747774;
  lucky[609] = 744747777;
  lucky[610] = 74477;
  lucky[611] = 744774;
  lucky[612] = 7447744;
  lucky[613] = 74477444;
  lucky[614] = 744774444;
  lucky[615] = 744774447;
  lucky[616] = 74477447;
  lucky[617] = 744774474;
  lucky[618] = 744774477;
  lucky[619] = 7447747;
  lucky[620] = 74477474;
  lucky[621] = 744774744;
  lucky[622] = 744774747;
  lucky[623] = 74477477;
  lucky[624] = 744774774;
  lucky[625] = 744774777;
  lucky[626] = 744777;
  lucky[627] = 7447774;
  lucky[628] = 74477744;
  lucky[629] = 744777444;
  lucky[630] = 744777447;
  lucky[631] = 74477747;
  lucky[632] = 744777474;
  lucky[633] = 744777477;
  lucky[634] = 7447777;
  lucky[635] = 74477774;
  lucky[636] = 744777744;
  lucky[637] = 744777747;
  lucky[638] = 74477777;
  lucky[639] = 744777774;
  lucky[640] = 744777777;
  lucky[641] = 747;
  lucky[642] = 7474;
  lucky[643] = 74744;
  lucky[644] = 747444;
  lucky[645] = 7474444;
  lucky[646] = 74744444;
  lucky[647] = 747444444;
  lucky[648] = 747444447;
  lucky[649] = 74744447;
  lucky[650] = 747444474;
  lucky[651] = 747444477;
  lucky[652] = 7474447;
  lucky[653] = 74744474;
  lucky[654] = 747444744;
  lucky[655] = 747444747;
  lucky[656] = 74744477;
  lucky[657] = 747444774;
  lucky[658] = 747444777;
  lucky[659] = 747447;
  lucky[660] = 7474474;
  lucky[661] = 74744744;
  lucky[662] = 747447444;
  lucky[663] = 747447447;
  lucky[664] = 74744747;
  lucky[665] = 747447474;
  lucky[666] = 747447477;
  lucky[667] = 7474477;
  lucky[668] = 74744774;
  lucky[669] = 747447744;
  lucky[670] = 747447747;
  lucky[671] = 74744777;
  lucky[672] = 747447774;
  lucky[673] = 747447777;
  lucky[674] = 74747;
  lucky[675] = 747474;
  lucky[676] = 7474744;
  lucky[677] = 74747444;
  lucky[678] = 747474444;
  lucky[679] = 747474447;
  lucky[680] = 74747447;
  lucky[681] = 747474474;
  lucky[682] = 747474477;
  lucky[683] = 7474747;
  lucky[684] = 74747474;
  lucky[685] = 747474744;
  lucky[686] = 747474747;
  lucky[687] = 74747477;
  lucky[688] = 747474774;
  lucky[689] = 747474777;
  lucky[690] = 747477;
  lucky[691] = 7474774;
  lucky[692] = 74747744;
  lucky[693] = 747477444;
  lucky[694] = 747477447;
  lucky[695] = 74747747;
  lucky[696] = 747477474;
  lucky[697] = 747477477;
  lucky[698] = 7474777;
  lucky[699] = 74747774;
  lucky[700] = 747477744;
  lucky[701] = 747477747;
  lucky[702] = 74747777;
  lucky[703] = 747477774;
  lucky[704] = 747477777;
  lucky[705] = 7477;
  lucky[706] = 74774;
  lucky[707] = 747744;
  lucky[708] = 7477444;
  lucky[709] = 74774444;
  lucky[710] = 747744444;
  lucky[711] = 747744447;
  lucky[712] = 74774447;
  lucky[713] = 747744474;
  lucky[714] = 747744477;
  lucky[715] = 7477447;
  lucky[716] = 74774474;
  lucky[717] = 747744744;
  lucky[718] = 747744747;
  lucky[719] = 74774477;
  lucky[720] = 747744774;
  lucky[721] = 747744777;
  lucky[722] = 747747;
  lucky[723] = 7477474;
  lucky[724] = 74774744;
  lucky[725] = 747747444;
  lucky[726] = 747747447;
  lucky[727] = 74774747;
  lucky[728] = 747747474;
  lucky[729] = 747747477;
  lucky[730] = 7477477;
  lucky[731] = 74774774;
  lucky[732] = 747747744;
  lucky[733] = 747747747;
  lucky[734] = 74774777;
  lucky[735] = 747747774;
  lucky[736] = 747747777;
  lucky[737] = 74777;
  lucky[738] = 747774;
  lucky[739] = 7477744;
  lucky[740] = 74777444;
  lucky[741] = 747774444;
  lucky[742] = 747774447;
  lucky[743] = 74777447;
  lucky[744] = 747774474;
  lucky[745] = 747774477;
  lucky[746] = 7477747;
  lucky[747] = 74777474;
  lucky[748] = 747774744;
  lucky[749] = 747774747;
  lucky[750] = 74777477;
  lucky[751] = 747774774;
  lucky[752] = 747774777;
  lucky[753] = 747777;
  lucky[754] = 7477774;
  lucky[755] = 74777744;
  lucky[756] = 747777444;
  lucky[757] = 747777447;
  lucky[758] = 74777747;
  lucky[759] = 747777474;
  lucky[760] = 747777477;
  lucky[761] = 7477777;
  lucky[762] = 74777774;
  lucky[763] = 747777744;
  lucky[764] = 747777747;
  lucky[765] = 74777777;
  lucky[766] = 747777774;
  lucky[767] = 747777777;
  lucky[768] = 77;
  lucky[769] = 774;
  lucky[770] = 7744;
  lucky[771] = 77444;
  lucky[772] = 774444;
  lucky[773] = 7744444;
  lucky[774] = 77444444;
  lucky[775] = 774444444;
  lucky[776] = 774444447;
  lucky[777] = 77444447;
  lucky[778] = 774444474;
  lucky[779] = 774444477;
  lucky[780] = 7744447;
  lucky[781] = 77444474;
  lucky[782] = 774444744;
  lucky[783] = 774444747;
  lucky[784] = 77444477;
  lucky[785] = 774444774;
  lucky[786] = 774444777;
  lucky[787] = 774447;
  lucky[788] = 7744474;
  lucky[789] = 77444744;
  lucky[790] = 774447444;
  lucky[791] = 774447447;
  lucky[792] = 77444747;
  lucky[793] = 774447474;
  lucky[794] = 774447477;
  lucky[795] = 7744477;
  lucky[796] = 77444774;
  lucky[797] = 774447744;
  lucky[798] = 774447747;
  lucky[799] = 77444777;
  lucky[800] = 774447774;
  lucky[801] = 774447777;
  lucky[802] = 77447;
  lucky[803] = 774474;
  lucky[804] = 7744744;
  lucky[805] = 77447444;
  lucky[806] = 774474444;
  lucky[807] = 774474447;
  lucky[808] = 77447447;
  lucky[809] = 774474474;
  lucky[810] = 774474477;
  lucky[811] = 7744747;
  lucky[812] = 77447474;
  lucky[813] = 774474744;
  lucky[814] = 774474747;
  lucky[815] = 77447477;
  lucky[816] = 774474774;
  lucky[817] = 774474777;
  lucky[818] = 774477;
  lucky[819] = 7744774;
  lucky[820] = 77447744;
  lucky[821] = 774477444;
  lucky[822] = 774477447;
  lucky[823] = 77447747;
  lucky[824] = 774477474;
  lucky[825] = 774477477;
  lucky[826] = 7744777;
  lucky[827] = 77447774;
  lucky[828] = 774477744;
  lucky[829] = 774477747;
  lucky[830] = 77447777;
  lucky[831] = 774477774;
  lucky[832] = 774477777;
  lucky[833] = 7747;
  lucky[834] = 77474;
  lucky[835] = 774744;
  lucky[836] = 7747444;
  lucky[837] = 77474444;
  lucky[838] = 774744444;
  lucky[839] = 774744447;
  lucky[840] = 77474447;
  lucky[841] = 774744474;
  lucky[842] = 774744477;
  lucky[843] = 7747447;
  lucky[844] = 77474474;
  lucky[845] = 774744744;
  lucky[846] = 774744747;
  lucky[847] = 77474477;
  lucky[848] = 774744774;
  lucky[849] = 774744777;
  lucky[850] = 774747;
  lucky[851] = 7747474;
  lucky[852] = 77474744;
  lucky[853] = 774747444;
  lucky[854] = 774747447;
  lucky[855] = 77474747;
  lucky[856] = 774747474;
  lucky[857] = 774747477;
  lucky[858] = 7747477;
  lucky[859] = 77474774;
  lucky[860] = 774747744;
  lucky[861] = 774747747;
  lucky[862] = 77474777;
  lucky[863] = 774747774;
  lucky[864] = 774747777;
  lucky[865] = 77477;
  lucky[866] = 774774;
  lucky[867] = 7747744;
  lucky[868] = 77477444;
  lucky[869] = 774774444;
  lucky[870] = 774774447;
  lucky[871] = 77477447;
  lucky[872] = 774774474;
  lucky[873] = 774774477;
  lucky[874] = 7747747;
  lucky[875] = 77477474;
  lucky[876] = 774774744;
  lucky[877] = 774774747;
  lucky[878] = 77477477;
  lucky[879] = 774774774;
  lucky[880] = 774774777;
  lucky[881] = 774777;
  lucky[882] = 7747774;
  lucky[883] = 77477744;
  lucky[884] = 774777444;
  lucky[885] = 774777447;
  lucky[886] = 77477747;
  lucky[887] = 774777474;
  lucky[888] = 774777477;
  lucky[889] = 7747777;
  lucky[890] = 77477774;
  lucky[891] = 774777744;
  lucky[892] = 774777747;
  lucky[893] = 77477777;
  lucky[894] = 774777774;
  lucky[895] = 774777777;
  lucky[896] = 777;
  lucky[897] = 7774;
  lucky[898] = 77744;
  lucky[899] = 777444;
  lucky[900] = 7774444;
  lucky[901] = 77744444;
  lucky[902] = 777444444;
  lucky[903] = 777444447;
  lucky[904] = 77744447;
  lucky[905] = 777444474;
  lucky[906] = 777444477;
  lucky[907] = 7774447;
  lucky[908] = 77744474;
  lucky[909] = 777444744;
  lucky[910] = 777444747;
  lucky[911] = 77744477;
  lucky[912] = 777444774;
  lucky[913] = 777444777;
  lucky[914] = 777447;
  lucky[915] = 7774474;
  lucky[916] = 77744744;
  lucky[917] = 777447444;
  lucky[918] = 777447447;
  lucky[919] = 77744747;
  lucky[920] = 777447474;
  lucky[921] = 777447477;
  lucky[922] = 7774477;
  lucky[923] = 77744774;
  lucky[924] = 777447744;
  lucky[925] = 777447747;
  lucky[926] = 77744777;
  lucky[927] = 777447774;
  lucky[928] = 777447777;
  lucky[929] = 77747;
  lucky[930] = 777474;
  lucky[931] = 7774744;
  lucky[932] = 77747444;
  lucky[933] = 777474444;
  lucky[934] = 777474447;
  lucky[935] = 77747447;
  lucky[936] = 777474474;
  lucky[937] = 777474477;
  lucky[938] = 7774747;
  lucky[939] = 77747474;
  lucky[940] = 777474744;
  lucky[941] = 777474747;
  lucky[942] = 77747477;
  lucky[943] = 777474774;
  lucky[944] = 777474777;
  lucky[945] = 777477;
  lucky[946] = 7774774;
  lucky[947] = 77747744;
  lucky[948] = 777477444;
  lucky[949] = 777477447;
  lucky[950] = 77747747;
  lucky[951] = 777477474;
  lucky[952] = 777477477;
  lucky[953] = 7774777;
  lucky[954] = 77747774;
  lucky[955] = 777477744;
  lucky[956] = 777477747;
  lucky[957] = 77747777;
  lucky[958] = 777477774;
  lucky[959] = 777477777;
  lucky[960] = 7777;
  lucky[961] = 77774;
  lucky[962] = 777744;
  lucky[963] = 7777444;
  lucky[964] = 77774444;
  lucky[965] = 777744444;
  lucky[966] = 777744447;
  lucky[967] = 77774447;
  lucky[968] = 777744474;
  lucky[969] = 777744477;
  lucky[970] = 7777447;
  lucky[971] = 77774474;
  lucky[972] = 777744744;
  lucky[973] = 777744747;
  lucky[974] = 77774477;
  lucky[975] = 777744774;
  lucky[976] = 777744777;
  lucky[977] = 777747;
  lucky[978] = 7777474;
  lucky[979] = 77774744;
  lucky[980] = 777747444;
  lucky[981] = 777747447;
  lucky[982] = 77774747;
  lucky[983] = 777747474;
  lucky[984] = 777747477;
  lucky[985] = 7777477;
  lucky[986] = 77774774;
  lucky[987] = 777747744;
  lucky[988] = 777747747;
  lucky[989] = 77774777;
  lucky[990] = 777747774;
  lucky[991] = 777747777;
  lucky[992] = 77777;
  lucky[993] = 777774;
  lucky[994] = 7777744;
  lucky[995] = 77777444;
  lucky[996] = 777774444;
  lucky[997] = 777774447;
  lucky[998] = 77777447;
  lucky[999] = 777774474;
  lucky[1000] = 777774477;
  lucky[1001] = 7777747;
  lucky[1002] = 77777474;
  lucky[1003] = 777774744;
  lucky[1004] = 777774747;
  lucky[1005] = 77777477;
  lucky[1006] = 777774774;
  lucky[1007] = 777774777;
  lucky[1008] = 777777;
  lucky[1009] = 7777774;
  lucky[1010] = 77777744;
  lucky[1011] = 777777444;
  lucky[1012] = 777777447;
  lucky[1013] = 77777747;
  lucky[1014] = 777777474;
  lucky[1015] = 777777477;
  lucky[1016] = 7777777;
  lucky[1017] = 77777774;
  lucky[1018] = 777777744;
  lucky[1019] = 777777747;
  lucky[1020] = 77777777;
  lucky[1021] = 777777774;
  lucky[1022] = 777777777;
  totallucky = 1022;
}