New Sensations!

0

0 votes
Easy
Problem

 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

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?