Error
|
|
---|---|
@Ibrahim Nash | 6381 |
@blackshadows | 6329 |
@mb1973 | 5388 |
@Quandray | 5231 |
@akhayrutdinov | 5111 |
@saiujwal13083 | 4510 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3522 |
@sushant_a | 3459 |
@verma_ji | 3357 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@1905439 | 553 |
@terabaap123 | 508 |
@smitadiwedi1991 | 279 |
@DevanandJayakumar | 250 |
@atishagusain | 244 |
@gupta_10 | 226 |
@nipun edara | 224 |
@shubhamkhullar7 | 224 |
@sharmachandan487 | 204 |
@balunagar | 204 |
@arshjit_singh7 | 190 |
Complete Leaderboard |
Given a no N you can perform an operation in it in which you can change a digit 5 to 6 and vice versa. Now your task is to print the sum of the max no and the min no obtained by performing such operations.
Input:
The first line of input contains an integer T denoting the no of test cases. Then T test case follow . Each test case contains a number N.
Output:
For each test case in a new line print the required sum.
Constraints:
1<=T<=100
1<=N<=10000
Example:
Input:
2
35
5
Output:
71
11
Explanation:
For first test case
The max no which can be formed is 36 and the min no which can be formed is 35 itself
sum : 36+35 = 71
For second test case
sum : 5+6 = 11
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes