Polycarp studies at the university in the group which consists of *n* students (including himself). All they are registrated in the social net "TheContacnt!".

Not all students are equally sociable. About each student you know the value *a*<sub class="lower-index">*i*</sub> — the maximum number of messages which the *i*-th student is agree to send per day. The student can't send messages to himself. 

In early morning Polycarp knew important news that the programming credit will be tomorrow. For this reason it is necessary to urgently inform all groupmates about this news using private messages. 

Your task is to make a plan of using private messages, so that:
 -  the student *i* sends no more than *a*<sub class="lower-index">*i*</sub> messages (for all *i* from 1 to *n*); -  all students knew the news about the credit (initially only Polycarp knew it); -  the student can inform the other student only if he knows it himself. 
Let's consider that all students are numerated by distinct numbers from 1 to *n*, and Polycarp always has the number 1.

In that task you shouldn't minimize the number of messages, the moment of time, when all knew about credit or some other parameters. Find any way how to use private messages which satisfies requirements above.
The first line contains the positive integer *n* (2 ≤ *n* ≤ 100) — the number of students. 

The second line contains the sequence *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 100), where *a*<sub class="lower-index">*i*</sub> equals to the maximum number of messages which can the *i*-th student agree to send. Consider that Polycarp always has the number 1.
In the first test Polycarp (the student number 1) can send the message to the student number 2, who after that can send the message to students number 3 and 4. Thus, all students knew about the credit.
4
1 2 1 0
3
1 2
2 3
2 4
6
2 0 1 3 2 0
5
1 4
1 5
4 3
4 2
4 6
3
0 2 2
-1
2
0 0
-1
2
1 0
1
1 2
2
0 1
-1
2
1 1
1
1 2
3
1 1 0
2
1 2
2 3
3
0 1 1
-1
3
1 0 0
-1
3
2 0 0
2
1 2
1 3
3
1 0 1
2
1 3
3 2
3
1 1 1
2
1 2
2 3
40
3 3 2 1 0 0 0 4 5 4 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 2 3 2 0 1 0 0 2 0 3 0 1 0
-1
100
1 0 0 2 0 2 0 0 2 0 0 2 0 0 2 2 2 1 1 2 1 2 2 2 1 2 0 1 0 1 0 2 2 2 0 1 2 0 0 2 0 2 0 1 1 0 1 0 2 0 0 2 1 2 1 2 2 2 2 1 0 2 0 0 1 0 2 0 0 2 0 1 0 2 1 1 2 2 2 2 0 0 2 0 2 1 0 0 0 1 0 2 2 2 0 1 0 1 1 0
99
1 4
4 6
4 9
6 12
6 15
9 16
9 17
12 20
12 22
15 23
15 24
16 26
16 32
17 33
17 34
20 37
20 40
22 42
22 49
23 52
23 54
24 56
24 57
26 58
26 59
32 62
32 67
33 70
33 74
34 77
34 78
37 79
37 80
40 83
40 85
42 92
42 93
49 94
49 18
52 19
52 21
54 25
54 28
56 30
56 36
57 44
57 45
58 47
58 53
59 55
59 60
62 65
62 72
67 75
67 76
70 86
70 90
74 96
74 98
77 99
77 2
78 3
78 5
79 7
79 8
80 10
80 11
83 13
83 14
85 27
85 29
92 31
92 35
93 38
93 3...
4
2 0 0 0
-1
4
2 0 0 1
3
1 4
1 2
4 3
4
2 0 1 0
3
1 3
1 2
3 4
4
2 1 0 0
3
1 2
1 3
2 4
100
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-1
100
99 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
99
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 70
1 71
1 72
1 73
1 74
1 75
1 76
1 77
1 78
1 79
1 80
1 81
1 82
1 83
1 84
1 85
1 86
1 87
...
100
98 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-1
100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
99
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
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
52 53
53 54
54 55
55 56
56 57
57 58
58 59
59 60
60 61
61 62
62 63
63 64
64 65
65 66
66 67
67 68
68 69
69 70
70 71
71 72
72 73
73 74
74 75
75 76
76 77
...
100
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
99
1 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
30 31
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
47 48
48 49
49 50
50 51
51 52
52 53
53 54
54 55
55 56
56 57
57 58
58 59
59 60
60 61
61 62
62 63
63 64
64 65
65 66
66 67
67 68
68 69
69 70
70 71
71 72
72 73
73 74
74 75
75 76
76 7...
100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
99
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
30 31
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
47 48
48 49
49 50
50 51
51 52
52 53
53 54
54 55
55 56
56 57
57 58
58 59
59 60
60 61
61 62
62 63
63 64
64 65
65 66
66 67
67 68
68 69
69 70
70 71
71 72
72 73
73 74
74 75
75 76
...
100
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
99
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 70
1 71
1 72
1 73
1 74
1 75
1 76
1 77
1 78
1 79
1 80
1 81
1 82
1 83
1 84
1 85
1 86
1 87
...
100
1 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
99
1 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2 10
2 11
2 12
2 13
2 14
2 15
2 16
2 17
2 18
2 19
2 20
2 21
2 22
2 23
2 24
2 25
2 26
2 27
2 28
2 29
2 30
2 31
2 32
2 33
2 34
2 35
2 36
2 37
2 38
2 39
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 47
2 48
2 49
2 50
2 51
2 52
2 53
2 54
2 55
2 56
2 57
2 58
2 59
2 60
2 61
2 62
2 63
2 64
2 65
2 66
2 67
2 68
2 69
2 70
2 71
2 72
2 73
2 74
2 75
2 76
2 77
2 78
2 79
2 80
2 81
2 82
2 83
2 84
2 85
2 86
2 87
...
100
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 98 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
99
1 55
55 2
55 3
55 4
55 5
55 6
55 7
55 8
55 9
55 10
55 11
55 12
55 13
55 14
55 15
55 16
55 17
55 18
55 19
55 20
55 21
55 22
55 23
55 24
55 25
55 26
55 27
55 28
55 29
55 30
55 31
55 32
55 33
55 34
55 35
55 36
55 37
55 38
55 39
55 40
55 41
55 42
55 43
55 44
55 45
55 46
55 47
55 48
55 49
55 50
55 51
55 52
55 53
55 54
55 56
55 57
55 58
55 59
55 60
55 61
55 62
55 63
55 64
55 65
55 66
55 67
55 68
55 69
55 70
55 71
55 72
55 73
55 74
55 75...
2
0 1
-1
5
0 0 1 1 2
-1
7
2 0 0 0 1 0 3
6
1 7
1 5
7 2
7 3
7 4
5 6
10
3 0 0 0 0 2 0 1 0 3
9
1 10
1 6
1 8
10 2
10 3
10 4
6 5
6 7
8 9
20
0 2 0 0 2 0 0 2 2 0 0 2 0 2 1 0 1 3 1 1
-1
30
2 0 2 2 0 2 2 0 0 0 3 0 1 1 2 0 0 2 2 0 1 0 3 0 1 0 2 0 0 1
29
1 11
1 23
11 3
11 4
11 6
23 7
23 15
23 18
3 19
3 27
4 13
4 14
6 21
6 25
7 30
7 2
15 5
15 8
18 9
18 10
19 12
19 16
27 17
27 20
13 22
14 24
21 26
25 28
30 29
31
2 0 0 4 0 0 0 0 0 0 0 0 0 3 2 0 0 0 0 0 3 0 4 3 0 2 0 0 0 3 4
30
1 4
1 23
4 31
4 14
4 21
4 24
23 30
23 15
23 26
23 2
31 3
31 5
31 6
31 7
14 8
14 9
14 10
21 11
21 12
21 13
24 16
24 17
24 18
30 19
30 20
30 22
15 25
15 27
26 28
26 29
39
2 0 3 0 0 2 0 0 2 1 1 0 0 3 3 0 2 0 2 3 0 0 3 0 3 2 0 0 3 0 0 0 3 0 0 0 0 0 0
38
1 3
1 14
3 15
3 20
3 23
14 25
14 29
14 33
15 6
15 9
15 17
20 19
20 26
20 10
23 11
23 2
23 4
25 5
25 7
25 8
29 12
29 13
29 16
33 18
33 21
33 22
6 24
6 27
9 28
9 30
17 31
17 32
19 34
19 35
26 36
26 37
10 38
11 39
58
4 2 1 3 5 3 0 0 1 0 3 0 2 1 0 0 0 4 0 0 0 0 0 1 2 3 4 0 1 1 0 0 1 0 0 0 2 0 0 0 0 2 2 0 2 0 0 4 0 2 0 0 0 0 0 1 0 0
57
1 5
1 18
1 27
1 48
5 4
5 6
5 11
5 26
5 2
18 13
18 25
18 37
18 42
27 43
27 45
27 50
27 3
48 9
48 14
48 24
48 29
4 30
4 33
4 56
6 7
6 8
6 10
11 12
11 15
11 16
26 17
26 19
26 20
2 21
2 22
13 23
13 28
25 31
25 32
37 34
37 35
42 36
42 38
43 39
43 40
45 41
45 44
50 46
50 47
3 49
9 51
14 52
24 53
29 54
30 55
33 57
56 58
65
3 0 0 0 0 3 0 0 0 0 0 4 2 0 0 0 0 0 0 0 0 8 0 0 0 0 0 6 7 0 3 0 0 0 0 4 0 3 0 0 0 0 1 0 0 5 0 0 0 0 3 0 0 4 0 0 0 0 0 1 0 0 0 0 7
64
1 22
1 29
1 65
22 28
22 46
22 12
22 36
22 54
22 6
22 31
22 38
29 51
29 13
29 43
29 60
29 2
29 3
29 4
65 5
65 7
65 8
65 9
65 10
65 11
65 14
28 15
28 16
28 17
28 18
28 19
28 20
46 21
46 23
46 24
46 25
46 26
12 27
12 30
12 32
12 33
36 34
36 35
36 37
36 39
54 40
54 41
54 42
54 44
6 45
6 47
6 48
31 49
31 50
31 52
38 53
38 55
38 56
51 57
51 58
51 59
13 61
13 62
43 63
60 64
77
7 0 0 0 0 0 0 0 0 8 0 0 0 0 3 0 0 0 0 9 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 2 6 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 7 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 8
76
1 20
1 63
1 10
1 37
1 77
1 24
1 60
20 44
20 15
20 43
20 55
20 2
20 3
20 4
20 5
20 6
63 7
63 8
63 9
63 11
63 12
63 13
63 14
63 16
63 17
10 18
10 19
10 21
10 22
10 23
10 25
10 26
10 27
37 28
37 29
37 30
37 31
37 32
37 33
37 34
37 35
77 36
77 38
77 39
77 40
77 41
77 42
77 45
77 46
24 47
24 48
24 49
24 50
24 51
24 52
24 53
60 54
60 56
60 57
60 58
60 59
60 61
60 62
44 64
44 65
44 66
44 67
44 68
44 69
15 70
15 71
15 72
43 73
43 74
55 7...
80
2 3 0 2 2 1 3 3 3 0 0 0 1 0 1 0 3 1 0 2 0 2 3 0 2 3 0 3 0 0 0 3 0 0 0 2 3 0 0 2 0 0 0 0 0 3 2 0 0 3 0 3 0 3 0 3 1 2 0 0 0 0 0 0 0 1 0 3 0 0 0 1 0 2 0 2 0 0 0 0
79
1 2
1 7
2 8
2 9
2 17
7 23
7 26
7 28
8 32
8 37
8 46
9 50
9 52
9 54
17 56
17 68
17 4
23 5
23 20
23 22
26 25
26 36
26 40
28 47
28 58
28 74
32 76
32 6
32 13
37 15
37 18
37 57
46 66
46 72
46 3
50 10
50 11
50 12
52 14
52 16
52 19
54 21
54 24
54 27
56 29
56 30
56 31
68 33
68 34
68 35
4 38
4 39
5 41
5 42
20 43
20 44
22 45
22 48
25 49
25 51
36 53
36 55
40 59
40 60
47 61
47 62
58 63
58 64
74 65
74 67
76 69
76 70
6 71
13 73
15 75
18 77
57...
90
2 0 0 0 0 1 2 0 1 1 0 1 0 4 0 1 1 0 1 0 1 0 1 1 2 0 0 1 2 3 0 1 1 0 0 1 1 0 0 2 0 2 2 1 0 1 0 0 2 0 1 4 2 0 1 2 2 0 1 0 0 5 0 0 3 0 1 2 0 0 0 0 2 3 0 0 3 3 0 3 3 0 0 0 1 0 1 2 2 2
89
1 62
1 14
62 52
62 30
62 65
62 74
62 77
14 78
14 80
14 81
14 7
52 25
52 29
52 40
52 42
30 43
30 49
30 53
65 56
65 57
65 68
74 73
74 88
74 89
77 90
77 6
77 9
78 10
78 12
78 16
80 17
80 19
80 21
81 23
81 24
81 28
7 32
7 33
25 36
25 37
29 44
29 46
40 51
40 55
42 59
42 67
43 85
43 87
49 2
49 3
53 4
53 5
56 8
56 11
57 13
57 15
68 18
68 20
73 22
73 26
88 27
88 31
89 34
89 35
90 38
90 39
6 41
9 45
10 47
12 48
16 50
17 54
19 58
21 60
23 ...
99
1 2 1 0 2 1 2 0 1 2 1 1 2 1 0 2 0 0 1 2 0 1 1 1 0 0 1 1 2 3 1 0 0 0 1 1 0 0 1 2 1 0 2 0 0 2 0 1 0 2 1 1 0 0 3 1 0 2 2 2 2 1 0 2 0 1 1 0 3 2 0 0 1 1 2 0 0 2 0 0 1 2 3 0 3 0 0 3 0 3 0 1 2 1 0 1 0 1 1
98
1 30
30 55
30 69
30 83
55 85
55 88
55 90
69 2
69 5
69 7
83 10
83 13
83 16
85 20
85 29
85 40
88 43
88 46
88 50
90 58
90 59
90 60
2 61
2 64
5 70
5 75
7 78
7 82
10 93
10 3
13 6
13 9
16 11
16 12
20 14
20 19
29 22
29 23
40 24
40 27
43 28
43 31
46 35
46 36
50 39
50 41
58 48
58 51
59 52
59 56
60 62
60 66
61 67
61 73
64 74
64 81
70 92
70 94
75 96
75 98
78 99
78 4
82 8
82 15
93 17
93 18
3 21
6 25
9 26
11 32
12 33
14 34
19 37
22 38
23 42
...
100
18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0 0 0 0 0 13 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 0
99
1 26
1 99
1 38
1 62
1 32
1 71
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
26 14
26 15
26 16
26 17
26 18
26 19
26 20
26 21
26 22
26 23
26 24
26 25
26 27
26 28
26 29
26 30
99 31
99 33
99 34
99 35
99 36
99 37
99 39
99 40
99 41
99 42
99 43
99 44
99 45
99 46
99 47
99 48
38 49
38 50
38 51
38 52
38 53
38 54
38 55
38 56
38 57
38 58
38 59
38 60
38 61
38 63
38 64
62 65
62 66
62 67
62 68
62 69
62 70
62 72
62 73
62 74
62 75
62 76
6...
100
3 2 1 0 1 0 0 0 2 3 2 1 0 0 0 3 1 1 3 0 1 1 1 3 0 2 2 2 0 1 1 1 0 0 1 0 2 1 1 2 1 0 0 0 1 1 0 3 0 0 0 4 1 2 0 0 0 1 0 3 2 0 0 2 0 3 0 1 4 2 1 0 0 1 1 0 1 0 0 4 0 1 0 1 0 1 1 0 0 0 0 1 2 0 0 0 3 3 0 2
99
1 52
1 69
1 80
52 10
52 16
52 19
52 24
69 48
69 60
69 66
69 97
80 98
80 2
80 9
80 11
10 26
10 27
10 28
16 37
16 40
16 54
19 61
19 64
19 70
24 93
24 100
24 3
48 5
48 12
48 17
60 18
60 21
60 22
66 23
66 30
66 31
97 32
97 35
97 38
98 39
98 41
98 45
2 46
2 53
9 58
9 68
11 71
11 74
26 75
26 77
27 82
27 84
28 86
28 87
37 92
37 4
40 6
40 7
54 8
54 13
61 14
61 15
64 20
64 25
70 29
70 33
93 34
93 36
100 42
100 43
3 44
5 47
12 49
17 50
18 ...
100
66 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 33 0 0 0
99
1 97
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
97 67
97 68
97 69
97 70
97 71
97 72
97 73
97 74
97 75
97 76
97 77
97 78
97 79
97 80
97 81
97 82
97 83
...
20
0 0 3 0 0 0 3 4 2 0 2 0 0 0 0 1 0 1 0 1
-1
60
3 0 0 1 0 0 0 0 3 1 3 4 0 0 0 3 0 0 0 2 0 3 4 1 3 3 0 2 0 4 1 5 3 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 1 0 1 0 3 0 0
-1
80
4 0 0 0 0 0 0 3 0 3 0 0 0 4 3 0 1 0 2 0 0 0 5 0 5 0 0 0 0 4 0 3 0 0 0 1 0 0 2 0 5 2 0 0 4 4 0 3 0 0 0 0 0 0 0 2 5 0 2 0 0 0 0 0 0 0 0 0 0 3 0 0 3 5 0 0 0 0 0 0
-1
100
2 0 0 2 0 0 0 0 0 2 0 0 0 5 0 0 0 0 0 0 0 1 0 7 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 6 0 7 4 0 0 0 0 5 0 0 0 0 0 0 7 4 0 0 0 0 0 0 7 7 0 0 0 0 0 2 0 0 0 0 0 0 0 0 4 7 7 0 0 0
-1
100
1 0 0 0 1 2 3 2 1 0 1 2 3 1 3 1 0 0 1 1 0 0 2 1 2 1 3 3 1 0 0 1 0 2 2 0 3 0 1 1 1 2 0 2 0 1 0 2 0 1 2 2 0 0 0 0 1 0 0 0 1 1 4 0 2 0 1 0 2 0 2 2 2 1 1 0 0 2 0 3 1 0 0 1 1 0 1 0 2 3 2 0 1 2 0 0 0 0 0 1
99
1 63
63 7
63 13
63 15
63 27
7 28
7 37
7 80
13 90
13 6
13 8
15 12
15 23
15 25
27 34
27 35
27 42
28 44
28 48
28 51
37 52
37 65
37 69
80 71
80 72
80 73
90 78
90 89
90 91
6 94
6 5
8 9
8 11
12 14
12 16
23 19
23 20
25 24
25 26
34 29
34 32
35 39
35 40
42 41
42 46
44 50
44 57
48 61
48 62
51 67
51 74
52 75
52 81
65 84
65 85
69 87
69 93
71 100
71 2
72 3
72 4
73 10
73 17
78 18
78 21
89 22
89 30
91 31
91 33
94 36
94 38
5 43
9 45
11 47
14 49
...
100
5 0 0 1 1 0 0 0 1 0 0 0 0 0 5 0 2 1 0 1 0 6 0 0 0 3 0 0 0 0 0 0 0 0 1 0 3 0 0 0 0 0 0 4 0 0 3 1 1 0 0 4 0 0 0 0 0 0 3 2 3 3 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 2 1 0 5 1 0 8 0 1 0 0 10 4 0 0 0 6 4 0 0 0 0 1
99
1 89
1 84
1 22
1 94
1 15
89 81
89 44
89 52
89 90
89 95
89 26
89 37
89 47
89 59
89 61
84 62
84 17
84 60
84 75
84 78
84 4
84 5
84 9
22 18
22 20
22 35
22 48
22 49
22 79
94 82
94 86
94 100
94 2
94 3
94 6
15 7
15 8
15 10
15 11
15 12
81 13
81 14
81 16
81 19
81 21
44 23
44 24
44 25
44 27
52 28
52 29
52 30
52 31
90 32
90 33
90 34
90 36
95 38
95 39
95 40
95 41
26 42
26 43
26 45
37 46
37 50
37 51
47 53
47 54
47 55
59 56
59 57
59 58
61 63
6...
100
47 0 0 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4 0 1 0 2 0 0 1 0 0 0 0 0 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0
99
1 47
1 12
1 66
1 33
1 93
1 37
1 81
1 25
1 35
1 40
1 46
1 61
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 34
1 36
1 38
1 39
1 41
1 42
47 43
47 44
47 45
47 48
47 49
47 50
47 51
47 52
47 53
47 54
47 55
47 56
47 57
47 58
47 59
47 60
47 62
47 63
12 64
12 65
12 67
12 68
12 69
12 70
12 71
12 72
12 73
66 74
66 75
66 76
66 77
66 78
66 79
66...
100
1 0 2 1 1 1 0 0 0 3 2 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 2 1 0 2 1 1 1 0 0 1 2 1 3 1 1 0 0 2 1 0 1 1 1 2 1 2 0 3 1 2 0 1 1 2 2 1 1 1 1 1 2 0 0 2 1 1 0 1 2 1 1 1 1 1 0 1 1 1 0 3 0 0 2 2 0 0 0 2 1 2 0
99
1 10
10 42
10 57
10 89
42 3
42 11
42 30
57 33
57 40
57 47
89 53
89 55
89 59
3 63
3 64
11 70
11 73
30 78
30 92
33 93
33 97
40 99
40 4
47 5
47 6
53 12
53 13
55 14
55 16
59 18
59 19
63 20
63 22
64 23
64 24
70 26
70 27
73 28
73 29
78 31
78 34
92 35
92 36
93 39
93 41
97 43
97 44
99 48
99 50
4 51
5 52
6 54
12 58
13 61
14 62
16 65
18 66
19 67
20 68
22 69
23 74
24 75
26 77
27 79
28 80
29 81
31 82
34 83
35 85
36 86
39 87
41 98
43 2
44 7
4...
100
83 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0
99
1 99
1 83
1 22
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 70
1 71
1 72
1 73
1 74
1 75
1 76
1 77
1 78
1 79
1 80
1 81
1 82
99 84
99 85
99 ...
100
1 1 0 1 0 1 1 1 2 1 0 1 1 0 1 2 1 1 1 1 2 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 2 2 2 2 1 1 0 1 2 1 1 0 1 1 0 1 0 1 1 0 0 1 1 1 1 1 1 2 0 2 1 2 1 1 0 0 1 1 1 1 0 2 4 2 1 1 1 0 1 2 1 1 1 0 2 1 2
99
1 86
86 9
86 16
86 21
86 44
9 45
9 46
16 47
16 52
21 71
21 73
44 75
44 85
45 87
45 93
46 98
46 100
47 2
47 4
52 6
52 7
71 8
71 10
73 12
73 13
75 15
75 17
85 18
85 19
87 20
87 22
93 23
93 25
98 27
98 28
100 29
100 30
2 31
4 32
6 33
7 34
8 35
10 36
12 37
13 38
15 39
17 41
18 42
19 48
20 49
22 51
23 53
25 54
27 56
28 57
29 59
30 61
31 62
32 65
33 66
34 67
35 68
36 69
37 70
38 74
39 76
41 77
42 80
48 81
49 82
51 83
53 88
54 89
56 90
...
100
99 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
99
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 70
1 71
1 72
1 73
1 74
1 75
1 76
1 77
1 78
1 79
1 80
1 81
1 82
1 83
1 84
1 85
1 86
1 87
...
100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
99
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
30 31
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
47 48
48 49
49 50
50 52
52 53
53 54
54 55
55 56
56 57
57 58
58 59
59 60
60 61
61 62
62 63
63 64
64 65
65 66
66 67
67 68
68 69
69 70
70 71
71 72
72 73
73 74
74 75
75 76
76 77
...
2
0 100
-1
2
100 0
1
1 2
2
100 100
1
1 2
def main():
    students = int(input())
    msgs = [int(x) for x in input().split()]
    if msgs[0] == 0:
        print('-1')
    elif students-1 > sum(msgs):
        print('-1')
    else:
        result = []
        no_info = [x for x in range(students)]
        no_info.remove(0)
        has_info = [0, ]
        for target in no_info:
            if msgs[target] == 0:
                continue
            else:
                has_info.append(target)
                no_info.remove(target)
                result.append('1 ' + str(target + 1))
                msgs[0] -= 1

        for item in has_info:
            if msgs[item] > 0:
                for target in no_info:
                    if msgs[target] == 0:
                        continue
                    else:
                        has_info.append(target)
                        no_info.remove(target)
                        result.append(str(item + 1) + ' ' + str(target + 1))
                        msgs[item] -= 1
        if len(no_info) > 0:
            for item in has_info:
                if msgs[item] > 0:
                    for target in no_info:
                        has_info.append(target)
                        no_info.remove(target)
                        result.append(str(item + 1) + ' ' + str(target + 1))
                        msgs[item] -= 1
        if len(no_info) > 0:
            print('-1')
        else:
            print(str(len(result)))
            for item in result:
                print(item)


if __name__ == "__main__":
    main()