Zoom along Waa

0

0 votes
Problem

Zoom along Waa is a simple game organised by Mathematics Department of SKIT. The goal of the game is to say positive integers in increasing order, with a twist: You don't say the numbers divisible by 3 and 5. Instead, whenever a number was divisible by 3 you say "zoom" and for a number divisible by 5 you say "waa". (Thus, if a number was divisible by 15, you say "zoomwaa".)

Here is how the game starts:

1, 2, zoom, 4, waa, zoom, 7, 8, zoom, waa, 11, zoom, 13, 14, zoomwaa, 16, 17, zoom, 19, waa, zoom, 22, 23, zoom, waa, 26, zoom, 28, 29, zoomwaa, 31, 32, zoom, 34, waa, zoom, ...

Zoom along Waa has also become a traditional programming question for SKIT's CS students. However, in this problem we have a more tricky assignment for you.

You are given longs A and B. Consider the part of the game that corresponds to integers from A to B, inclusive. During this part of the game, you will say "zoom" X times, "waa" Y times, and "zoomwaa" Z times. You have to determine X, Y and Z.

Input :

First line of input contains an integer T, denoting the number of test cases. Each test case have one line of input containing two space separated integers, A and B.

Output :

Print the value of X, Y and Z on a single by space separation for each test case.

Constraints :

  • 1 <= A <= 10^18
  • A <= B <= 10^18
  • 1 <= T <= 4
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Test Case #1:

This is the sequence "1, 2, zoom, 4".

Test Case #2:

This is the sequence "2, zoom, 4, waa, zoom".

Similarly for test case #3 and #4

Editor Image

?