There are *n* shovels in Polycarp's shop. The *i*-th shovel costs *i* burles, that is, the first shovel costs 1 burle, the second shovel costs 2 burles, the third shovel costs 3 burles, and so on. Polycarps wants to sell shovels in pairs.

Visitors are more likely to buy a pair of shovels if their total cost ends with several 9s. Because of this, Polycarp wants to choose a pair of shovels to sell in such a way that the sum of their costs ends with maximum possible number of nines. For example, if he chooses shovels with costs 12345 and 37454, their total cost is 49799, it ends with two nines.

You are to compute the number of pairs of shovels such that their total cost ends with maximum possible number of nines. Two pairs are considered different if there is a shovel presented in one pair, but not in the other.
The first line contains a single integer *n* (2 ≤ *n* ≤ 10<sup class="upper-index">9</sup>) — the number of shovels in Polycarp's shop.
In the first example the maximum possible number of nines at the end is one. Polycarp cah choose the following pairs of shovels for that purpose:
 -  2 and 7; -  3 and 6; -  4 and 5. 
In the second example the maximum number of nines at the end of total cost of two shovels is one. The following pairs of shovels suit Polycarp:
 -  1 and 8; -  2 and 7; -  3 and 6; -  4 and 5; -  5 and 14; -  6 and 13; -  7 and 12; -  8 and 11; -  9 and 10. 
In the third example it is necessary to choose shovels 49 and 50, because the sum of their cost is 99, that means that the total number of nines is equal to two, which is maximum possible for *n* = 50.
7
3
14
9
50
1
999999999
499999999
15
11
3
3
6500
1501
4
6
13
8
10
5
499999
1249995
6
2
8
4
9
4
11
6
12
7
5
1
16
13
17
15
18
17
19
18
20
20
21
22
22
24
23
26
24
28
25
31
26
34
27
37
28
40
29
42
30
45
31
48
32
51
33
54
34
57
35
61
36
65
37
69
38
73
39
76
40
80
41
84
42
88
43
92
44
96
45
101
46
106
47
111
48
116
49
120
51
2
100
50
99
49
101
51
4999
12495
4998
12491
4992
12461
5000
1
5001
2
10000
5000
10001
5001
49839
124196
4999999
12499995
49999999
124999995
499999999
1249999995
999
499
9999
4999
99999
49999
999999
499999
9999999
4999999
99999999
49999999
2
1
1000000000
500000000
764675465
264675466
499999998
1249999991
167959139
135918279
641009859
141009860
524125987
24125988
702209411
202209412
585325539
85325540
58376259
8376260
941492387
441492388
824608515
324608516
2691939
3575818
802030518
302030519
685146646
185146647
863230070
363230071
41313494
85253976
219396918
238793836
102513046
52513046
985629174
485629175
458679894
1043399471
341796022
575388066
519879446
19879447
452405440
1012027201
335521569
556564707
808572289
308572290
691688417
191688418
869771841
369771842
752887969
252887970
930971393
430971394
109054817
59054817
992170945
492170946
170254369
140508739
248004555
296009110
n = int(input())
a= 5
while a * 10 <= n:
    a *= 10
print(sum(min(n - i * a + 1, a * i - 1) for i in range(1, n // a + 1)) if n>=5 else n*(n-1)//2)