Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

One night Petya was sleeping. He was dreaming of being the president of some island country. The country is represented by islands connected by two-way roads. Between some islands there is no road way, even through other islands, that's why the country is divided into several regions. More formally, each island belongs to exactly one region, there is a path between any two islands located in the same region; there is no path between any two islands from different regions. A region is lucky if the amount of islands in it is a lucky number.

As a real president, Petya first decided to build a presidential palace. Being a lucky numbers' fan, Petya wants to position his palace in one of the lucky regions. However, it is possible that initially the country has no such regions. In this case Petya can build additional roads between different regions, thus joining them. Find the minimum number of roads needed to build to create a lucky region.
The first line contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 10<sup class="upper-index">5</sup>). They are the number of islands and the number of roads correspondingly. Next *m* lines contain road descriptions. Each road is defined by the numbers of islands that it connects: that is, by two integers *u* and *v* (1 ≤ *u*, *v* ≤ *n*). Some roads can connect an island with itself; there can be more than one road between a pair of islands. Numbers in each line are separated by exactly one space character.
none
4 3
1 2
2 3
1 3
1
5 4
1 2
3 4
4 5
3 5
-1
7 6
1 2
2 3
3 4
4 5
5 6
6 7
0
7 5
2 3
3 4
4 5
3 6
2 2
2
1 1
1 1
-1
2 3
1 2
2 1
1 2
-1
10 1
1 10
2
4 6
1 2
1 3
1 4
3 4
2 4
2 3
0
16 14
2 3
2 4
4 3
5 6
7 6
8 9
12 13
12 14
15 14
13 15
13 14
12 15
16 13
15 16
1
15 14
2 3
2 4
3 4
5 6
6 7
8 9
8 10
8 11
12 13
12 14
14 15
13 15
12 15
13 14
0
4 1
3 3
3
7 1
5 5
3
47 10
1 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
3
47 45
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
1
20 10
13 7
19 1
5 10
3 2
6 19
3 12
12 10
4 3
5 7
11 9
1
20 50
1 13
1 13
11 4
15 8
8 4
4 1
19 12
15 16
9 20
2 16
9 11
17 6
2 11
9 6
3 7
4 14
14 6
9 4
4 16
11 7
14 7
15 2
12 12
15 13
6 8
5 9
20 19
20 14
12 8
11 11
12 10
20 19
5 18
5 19
10 13
17 13
2 15
17 12
9 7
7 6
19 18
13 3
11 19
3 7
15 11
15 15
5 10
13 8
17 14
2 2
-1
20 1
5 15
2
20 5
10 19
11 20
14 3
16 15
19 1
1
20 30
17 4
10 17
12 3
9 11
17 2
13 12
6 11
14 19
11 14
6 19
18 3
15 1
10 18
3 20
16 15
9 6
13 12
17 5
5 13
20 18
8 19
13 1
2 5
12 15
5 19
6 13
15 16
19 19
19 15
16 6
-1
20 15
10 9
4 14
16 13
13 5
9 10
20 13
13 11
16 14
14 9
14 20
1 19
8 20
7 12
3 20
7 17
1
30 20
29 21
22 2
8 18
16 15
9 12
28 12
24 1
15 23
1 14
18 3
14 10
5 8
19 4
13 29
15 29
30 24
28 25
17 3
8 26
27 20
0
30 4
4 28
7 18
16 17
16 11
1
47 20
41 32
5 36
4 14
15 45
10 36
24 7
12 25
12 43
31 19
28 11
41 43
9 39
33 20
33 28
28 1
39 19
8 20
36 42
22 45
29 7
0
50 50
17 30
29 29
50 42
15 18
34 10
30 3
44 11
4 35
42 8
14 41
30 4
11 1
3 23
7 28
35 6
24 37
6 12
8 7
36 40
41 26
13 46
15 40
32 34
15 28
46 31
36 25
38 43
16 19
35 9
6 21
16 42
38 43
32 12
12 32
43 21
16 35
3 11
24 13
36 24
43 22
29 36
18 15
29 47
30 31
4 7
18 42
9 48
17 32
42 9
2 6
1
64 18
35 37
30 35
56 39
18 46
26 35
39 48
50 27
5 12
28 54
18 51
31 60
1 63
5 51
20 5
23 53
64 11
17 50
14 27
0
100 40
13 92
21 56
53 71
55 8
35 39
45 54
84 14
16 15
15 7
75 31
76 5
32 70
31 71
77 67
38 10
27 48
24 28
33 19
61 70
26 74
11 85
20 15
67 17
37 38
20 66
8 31
62 8
2 7
71 90
91 67
55 35
7 57
10 22
85 64
18 61
75 23
64 50
30 99
27 45
49 42
0
100 3
54 47
85 25
59 47
1
1000 1
908 655
2
1000 10
117 228
530 348
119 116
239 658
102 791
736 786
617 192
396 109
286 509
754 207
1
5000 24
4725 3848
4135 4259
2109 3306
213 3847
1627 3379
4290 2314
9 774
3174 4435
1778 3821
1128 1465
3011 74
501 2861
2935 1995
989 4268
3944 1154
3172 1888
3817 2992
398 4722
4873 4958
1196 4398
3441 1536
4259 3474
4559 1598
2163 2612
1
100000 1
16796 47477
2
20 19
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
-1
7 6
1 2
2 3
3 4
4 5
5 6
6 7
0
20 17
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
12 13
13 14
14 15
15 16
16 17
17 18
18 19
-1
47 42
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
37 38
38 39
39 40
40 41
42 43
43 44
44 45
45 46
4
7 5
1 2
2 3
3 4
4 5
6 7
1
4 2
2 3
3 4
1
from collections import defaultdict

def is_lucky(num):
    return set(str(num)) <= {'4', '7'}

def min_roads_to_lucky_region(n, m, roads):
    graph = defaultdict(list)
    
    for u, v in roads:
        graph[u].append(v)
        graph[v].append(u)
    
    regions = []
    visited = [False] * (n + 1)
    
    def dfs(node):
        visited[node] = True
        size = 1
        for neighbor in graph[node]:
            if not visited[neighbor]:
                size += dfs(neighbor)
        return size
    
    for i in range(1, n + 1):
        if not visited[i]:
            region_size = dfs(i)
            regions.append(region_size)
    
    total_islands = sum(regions)
    needed_size = 4 - (total_islands % 4)
    
    if needed_size == 4:
        return 0  # No additional roads needed, already a lucky number
    if needed_size >= 1:
        return needed_size  # Additional roads needed to create a lucky region
    return -1  # No solution

n, m = map(int, input().split())
roads = [list(map(int, input().split())) for _ in range(m)]

result = min_roads_to_lucky_region(n, m, roads)
print(result)
