**Compilation/Execution Result:**

29.54%

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

71

11

The max no which can be formed is 36 and the min no which can be formed is 35 itself

sum : 36+35 = 71

sum : 5+6 = 11

dauntless | 84 |

rksingh | 74 |

iharshitmittal | 74 |

sj5331 | 69 |

madhumitha d rao | 66 |

Shashank_Pathak | 636 |

dark_knights | 560 |

surbhi_7 | 556 |

SANJAY5797 | 359 |

rksingh | 358 |

akhayrutdinov | 4159 |

sanjay05 | 3611 |

Quandray | 2829 |

Ibrahim Nash | 2501 |

Michael Riegger | 2296 |