Help needed to understand the problem statement

Hi, I got the below problem statement as part of a coding event in my Organization. Can someone please help me to decipher this question. I do not understand the sample output given.

Micro’s math teacher just taught him about Modular Arithmetic, and gave him an assignment to solve. Assignment is really large and will take a lot of his time. Micro wants to go out and play as soon as possible. The assignment consists of some decimal numbers and Micro has to find out the value of their modulo 10^9+7.

Input: First line consists of T denoting the number of test cases. Each of the following T lines consists of a decimal number.

Output: For each test case print the value of decimal number modulo 10^9+7, and if modulo does not exists print -1. Print a new line after each test case.

Constraints: 1≤T≤5×10^5 1≤Total number of digits in the number≤18 1≤Number of digits after decimal point≤9

SAMPLE INPUT

2
1.23
4.0

SAMPLE OUTPUT

110000002
4

Thank you.

You need to find out representation of number X in the field by modulo 10^9+7.

In base 10, your number looks like \sum_{i=0..infinity}10^i*a_{i} (before the decimal point) + \sum_{i=1..infinity}*10^{-i}*b_{i} (after the decimal point).

You need to calculate it by modulo 10^9+7, also you need to know about modular inverse

10^{-1} = 700000005 (modulo 10^9+7)

1.23 = 10^0 * 1 + 10^{-1} * 2 + 10^{-2} * 3 = 1 + 700000005 * 2 + 700000005 * 700000005 * 3 (modulo 10^9+7) = 110000002

2 Likes