🏡 index : github.com/captn3m0/codechef.git

---
languages_supported:
    - NA
title: D4
category: NA
old_version: true
problem_code: D4
tags:
    - NA
layout: problem
---
###  All submissions for this problem are available. 

Johnny has created a table which encodes the results of some operation -- a function of two arguments. But instead of a boring multiplication table of the sort you learn by heart at prep-school, he has created a GCD (greatest common divisor) table! So he now has a table (of height a and width b), indexed from (1,1) to (a,b), and with the value of field (i,j) equal to gcd(i,j). He wants to know how many times he has used prime numbers when writing the table.

### Input

First, t ≤ 10, the number of test cases. Each test case consists of two integers, 1 ≤ a,b < 107.

### Output

For each test case write one number - the number of prime numbers Johnny wrote in that test case.

### Example

<pre>
<b>Input:</b>
2
10 10
100 100

<b>Output:</b>
30
2791
</pre>