Little Gyro and Sets
题号:NC200113
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Little Gyro has just found an empty integer set A in his right pocket, and an empty integer set B in his left pocket. At the same time, Little Gyro has already thought about two integers n, m in his mind. As Little Gyro is bored, he decides to play with these two sets.
Then, Little Gyro is ready to divide the integer series to these two empty sets. With the following rules:
1. If the number is an integer multiple of n, Little Gyro will put it in set A.
2. Otherwise, Little Gyro will put it in set B instead.
Now given two integers n, m, after these operations, Little Gyro wants to know the result of sum(B)-sum(A) and ask you for help, please help him to calculate.

输入描述:

There are multiple test cases. The first line of the input contains an integer T (1 ≤ T ≤ ), indicating the number of test cases. For each test case:
Each line contains two integers n, m (1 ≤ n, m ≤ ), indicating the length of the sequence.

输出描述:

For each test case output an integer indicating the result of sum(B)-sum(A).
示例1

输入

复制
3
3 5
2 10
3 16

输出

复制
9
-5
46

说明

For the first sample, after these operations, A = < 3 >, B = < 1, 2, 4, 5 >, and the answer is 9.
For the second sample, after these operations, A = < 2, 4, 6, 8, 10 >, B = < 1, 3, 5, 7, 9 >, and the answer is -5.