New Language
Practice
4.1 (7 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
47% Success 1732 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

A new mathematical language (let's call it Ninja) is discovered, in which 8 is completely missing.
So, new counting becomes \(\left( 1,2,3,4,5,6,7,9,10,...\right)\). Whole counting is written without 8.
For example, \(29\) comes after \(27, 90\) comes after \(79\), etc.
Thus \(27+1 = 29\), \(79+1 = 90\).
Now, your task is to perform addition, subtraction, multiplication and division operations on two numbers in this new language Ninja.
NOTE : The final output also has to be in the language Ninja.

Input Format
The first line contains an integer, T, denoting the number of test cases.
For each test case, two integers a and b are given, separated with any one of the above operation \((+,-,*,/)\).
It is guaranteed that answer will not be negative.
For division operation, you have to answer integer division.

Output Format
For each test case, print the output of operation in Ninja.

Constraints

  • \(1 \leq T \leq 10^{5} \)
  • \(0 \leq a,b \leq 10^{9} \)( a and b are in Ninja language )
  • \(b \neq 0\) for division(\(/\)) operation
  • \(a \geq b\) for subtract(\(-\)) operation

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
393 votes
Tags:
Ad-HocApprovedEasyOpenSorting
Points:20
8 votes
Tags:
Basic ProgrammingEasySorting
Points:20
18 votes
Tags:
Ad-HocEasyImplementation