Rahul and His Reward

3

7 votes
Easy
Problem

Rahul, the event head for Hide NCK has put in a lot of hard work in the preparation of the event. To reward his efforts, the college has decided to give him N chocolates each with a specific taste value. But Rahul is very picky and will only eat chocolates whose taste value is a multiple of 3 and 5. Rahul knows the taste value of all the N chocolates. Help him find the total taste value of all the chocolates he will eat.

INPUT:

The first line will contain an integer T denoting the number of test-cases. Each test case starts with an integer N, denoting the number of chocolates. The next line will contain N space separated integers (A[0], A[1], …, A[N-1]) denoting the taste values of the N chocolates.

OUTPUT:

Answer for T test cases on T lines.

CONSTRAINTS:

1 <= T <= 100

1 <= N <= 10000

1 <= A[i] <= 10000000000

Sample Input
2
2
1 2
5
1 10000000000 9 45 75
Sample Output
0
120
Time Limit: 3
Memory Limit: 256
Source Limit:
Explanation

In the first test case none of the chocolates has a taste value that is a multiple of 3 and 5. Therefore the final taste value is 0.

Editor Image

?