Submit Best Submissions All Submissions

179. Rami and The Number 7

Problem Statement:
Rami's little sister Rama is always spying on him. She always reads everything he writes on his notebook. Fortunately she is a baby, so she can only read numbers.

Rama hates the number 7 and ignores any number divisible by 7 (e.g. 7, 14, 21...), and Rami wants to use this to hide his calculations from Rama. He asks for your help to do this.

Your job is to write a program that takes a number x and output the smallest possible multiple of x that divides 7.

Input Format:
The first line of input has one integer T, which is the number of test cases. Next there are T cases.

Each case has one line with a single integer number x. ( 1 ≤ x ≤ 109 )

Output Format:
For each test case output a single line with the smallest multiple of x that is divisible by 7.

Sample Input:
3 1 2 10

Sample Output:
7 14 70

In the first test case: x=1. So the smallest multiple that is divisible by 7 is 1*7 = 7

Added by: samiemad
Added at: 2014-07-26 09:00:11 UTC
Time Limit: 1 second
Partial score: No
Source:Practical C++ and Algorithms Course, Level 1, By. Sami EMAD