New Sensations!
Practice
0 (0 votes)
Easy
Problem
14% Success 303 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

 Sameer loves Namit and Ajay (as a brother) and today is their birthday. So, Sameer Bought some Toffee for them.But being younger than Namit, Ajay wants maximum toffee otherwise he will be sad. To make both of them happy, Sameer can't give all the toffee to Ajay, so, he has to distribute toffee in between them. Ajay wants Toffee only in multiple of 3, and Namit want Toffee only in multiple of 5. Sameer is having hard time in distributing toffee between them. Write a program for him to distribute toffees so that both of them will be happy.Initially Sameer has N toffees.

Input format:
First line contain number of testcases, T.
Next T lines contain total number of toffee, N sameer bought.

Output Format:
Output will contain number of toffee Ajay will get, if not possible print -1.

Constraints:
1 <= T <= 105,
1 <= N <= 1010

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
1 votes
Tags:
MathematicsEasyMathematicsMathamatics
Points:20
2 votes
Tags:
Basic Algebra
Points:20
1 votes
Tags:
EasySimple-math
Editorial

No editorial available for this problem.