Anton has the integer *x*. He is interested what positive integer, which doesn't exceed *x*, has the maximum sum of digits.

Your task is to help Anton and to find the integer that interests him. If there are several such integers, determine the biggest of them.
The first line contains the positive integer *x* (1 ≤ *x* ≤ 10<sup class="upper-index">18</sup>) — the integer which Anton has.
none
100
99
48
48
521
499
1
1
2
2
3
3
39188
38999
5
5
6
6
7
7
8
8
9
9
10
9
59999154
59998999
1000
999
10000
9999
100000
99999
1000000
999999
10000000
9999999
100000000
99999999
1000000000
999999999
10000000000
9999999999
100000000000
99999999999
1000000000000
999999999999
10000000000000
9999999999999
100000000000000
99999999999999
1000000000000000
999999999999999
10000000000000000
9999999999999999
100000000000000000
99999999999999999
1000000000000000000
999999999999999999
999999990
999999989
666666899789879
599999999999999
65499992294999000
59999999999999999
9879100000000099
8999999999999999
9991919190909919
9989999999999999
978916546899999999
899999999999999999
5684945999999999
4999999999999999
999999999999999999
999999999999999999
999999999999990999
999999999999989999
999999999999999990
999999999999999989
909999999999999999
899999999999999999
199999999999999999
199999999999999999
299999999999999999
299999999999999999
999999990009999999
999999989999999999
999000000001999999
998999999999999999
999999999991
999999999989
999999999992
999999999989
79320
78999
99004
98999
99088
98999
99737
98999
29652
28999
59195
58999
19930
19899
49533
48999
69291
68999
59452
58999
11
9
110
99
111
99
119
99
118
99
1100
999
1199
999
1109
999
1190
999
12
9
120
99
121
99
129
99
128
99
1200
999
1299
999
1209
999
1290
999
13
9
130
99
131
99
139
99
138
99
1300
999
1399
999
1309
999
1390
999
14
9
140
99
141
99
149
99
148
99
1400
999
1499
999
1409
999
1490
999
15
9
150
99
151
99
159
99
158
99
1500
999
1599
999
1509
999
1590
999
16
9
160
99
161
99
169
99
168
99
1600
999
1699
999
1609
999
1690
999
17
9
170
99
171
99
179
99
178
99
1700
999
1799
999
1709
999
1790
999
18
18
180
99
181
99
189
189
188
99
1800
999
1899
1899
1809
999
1890
999
19
19
190
189
191
189
199
199
198
198
1900
1899
1999
1999
1909
1899
1990
1989
20
19
200
199
201
199
209
199
208
199
2000
1999
2099
1999
2009
1999
2090
1999
21
19
210
199
211
199
219
199
218
199
2100
1999
2199
1999
2109
1999
2190
1999
22
19
220
199
221
199
229
199
228
199
2200
1999
2299
1999
2209
1999
2290
1999
23
19
230
199
231
199
239
199
238
199
2300
1999
2399
1999
2309
1999
2390
1999
24
19
240
199
241
199
249
199
248
199
2400
1999
2499
1999
2409
1999
2490
1999
25
19
250
199
251
199
259
199
258
199
2500
1999
2599
1999
2509
1999
2590
1999
26
19
260
199
261
199
269
199
268
199
2600
1999
2699
1999
2609
1999
2690
1999
27
19
270
199
271
199
279
199
278
199
2700
1999
2799
1999
2709
1999
2790
1999
28
28
280
199
281
199
289
289
288
199
2800
1999
2899
2899
2809
1999
2890
1999
29
29
290
289
291
289
299
299
298
298
2900
2899
2999
2999
2909
2899
2990
2989
999
999
999
999
890
889
995
989
999
999
989
989
999
999
999
999
991
989
999
999
9929
9899
4999
4999
9690
8999
8990
8989
9982
9899
9999
9999
1993
1989
9367
8999
8939
8899
9899
9899
99999
99999
93929
89999
99999
99999
38579
29999
79096
78999
72694
69999
99999
99999
99999
99999
99992
99989
27998
19999
460999
399999
999999
999999
999999
999999
998999
998999
999999
999999
999929
999899
999999
999999
999999
999999
979199
899999
999999
999999
9899999
9899999
9699959
8999999
9999999
9999999
9997099
9989999
8992091
8989999
9599295
8999999
2999902
2999899
9999953
9999899
9999999
9999999
9590999
8999999
def my_sum(a):
    return sum([int(a) for a in a])


from collections import *

x, n, flag = input(), deque([]), 1

if len(x) == 1:
    exit(print(x))

for i in range(len(x) - 1, -1, -1):
    if x[i] == '9':
        if flag:
            n.appendleft('8')
            flag = 0
        else:
            n.appendleft('9')
    else:
        if i > 0:
            n.appendleft('9')
        else:
            if flag:
                n.appendleft(str(int(x[i]) - 1))
            else:
                n.appendleft(x[i])

if n[0] == '0':
    n.popleft()

ans1, ans2 = x, ''.join(n)
if my_sum(ans1) >= my_sum(ans2):
    print(ans1)
else:
    print(ans2)
