Richik$Richik$ has just completed his engineering and has got a job in one of the firms at Sabrina$Sabrina$ which is ranked among the top seven islands in the world in terms of the pay scale. 
Since Richik$Richik$ has to travel a lot to reach the firm, the owner assigns him a number X$X$, and asks him to come to work only on the day which is a multiple of X$X$. Richik joins the firm on 1-st day but starts working from X-th day. Richik$Richik$ is paid exactly the same amount in Dollars as the day number. For example, if Richik$Richik$ has been assigned X=3$X = 3$, then he will be paid 3$3$ dollars and 6$6$ dollars on the 3rd$3rd$ and 6th$6th$ day on which he comes for work. 
On N−th$N-th$ day, the owner calls up Richik$Richik$ and asks him not to come to his firm anymore. Hence Richik$Richik$ demands his salary of all his working days together. Since it will take a lot of time to add, Richik$Richik$ asks help from people around him, let's see if you can help him out. 

-----Input:-----
- First line will contain T$T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single line of input, two integers X,N$X, N$. 

-----Output:-----
For each testcase, output in a single line which is the salary which Richik$Richik$ demands. 

-----Constraints-----
- 1≤T≤1000$1 \leq T \leq 1000$
- 1≤X<=N≤107$1 \leq X<=N \leq 10^7$

-----Sample Input:-----
1
3 10

-----Sample Output:-----
18

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t = int(input())
for i in range(t):
	(x, n) = [int(g) for g in input().split()]
	sal = 0
	day = x
	while day < n:
		sal = sal + day
		day += x
	print(sal)


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	r = r - 1
	n = r // l
	sum_ = n * (2 * l + (n - 1) * l)
	print(sum_ // 2)


T = int(input())
for i in range(T):
	(X, N) = list(map(int, input().split()))
	a = N // X
	if N % X != 0:
		S = (2 * X + (a - 1) * X) * (a / 2)
	else:
		S = (2 * X + (a - 2) * X) * ((a - 1) / 2)
	print(int(S))


for _ in range(int(input())):
	(x, n) = map(int, input().split())
	r = 0
	i = 1
	while x * i < n:
		r += x * i
		i += 1
	print(r)


t = int(input())
for i in range(t):
	(x, n) = input().split()
	x = int(x)
	n = int(n)
	s = 0
	for j in range(x, n, x):
		s = s + j
	print(s)


def inp():
	return int(input())

def linp():
	return list(map(int, input().split(' ')))

def minp():
	return map(int, input().split(' '))

def prn(xx):
	for yy in xx:
		print(yy, end=' ')
t = inp()
for _ in range(t):
	(n, m) = minp()
	m -= 1
	kk = m // n
	sm = n + n * kk
	sm *= kk
	sm //= 2
	print(sm)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	i = a
	total = 0
	j = 1
	while b > i:
		total = total + a * j
		j += 1
		i += a
	print(total)


t = int(input())
while t != 0:
	(x, k) = map(int, input().split())
	cnt = 0
	if k % x == 0:
		a = k / x - 1
	else:
		a = int(k / x)
	for i in range(1, int(a) + 1):
		cnt += x * i
	print(cnt)
	t -= 1


for i in range(int(input())):
	(x, n) = map(int, input().split())
	s = 0
	if n == x:
		print('0')
	else:
		a = int((n - 1) / x)
		s = a * (2 * x + (a - 1) * x) / 2
		print(int(s))


tc = int(input())
for i in range(0, tc):
	(x, n) = map(int, input().split())
	i = 1
	asum = 0
	while x * i < n:
		asum = asum + x * i
		i += 1
	print(asum)


t = int(input())
for _ in range(t):
	(x, n) = map(int, input().strip().split())
	n -= 1
	k = n // x
	ans = k / 2 * (2 * x + (k - 1) * x)
	print(int(ans))


for T in range(int(input())):
	(n, m) = map(int, input().split())
	m -= 1
	x = int(m / n)
	ans = n * int(x * (x + 1) / 2)
	print(ans)


t = int(input())
for i in range(t):
	a = input().split()
	k = int(a[0])
	n = int(a[1])
	maxlim = n - n % k
	no = maxlim / k
	ans = (k + maxlim) * no / 2
	if n % k != 0:
		print(int(ans))
	else:
		print(int(ans - n))


for _ in range(int(input())):
	(x, n) = list(map(int, input().split()))
	nn = n // x
	ss = nn * (x + x * nn) // 2
	if n % x == 0:
		print(ss - n)
	else:
		print(ss)


n = int(input())
for j in range(n):
	x = [int(y) for y in input().split(' ')]
	if x[1] % x[0] == 0:
		x[1] = x[1] - 1
	p = x[1] // x[0]
	p = p * x[0]
	print(p * (x[0] + p) // (x[0] * 2))


t = int(input())
for _ in range(t):
	(x, n) = map(int, input().split())
	a = []
	for i in range(1, n):
		if i % x == 0:
			a.append(i)
	print(sum(a))


T = int(input())
for q in range(T):
	(x, y) = list(map(int, input().strip().split()))
	y = (y - 1) // x
	print(x * y * (y + 1) // 2)


t = int(input())
for _ in range(t):
	ans = 0
	(x, n) = map(int, input().split())
	for i in range(x, n, x):
		ans = ans + i
	print(ans)


for _ in range(int(input())):
	(a, b) = [int(j) for j in input().split()]
	k = b // a
	if b % a != 0:
		print(a * (k * (k + 1) // 2))
	else:
		print(a * (k * (k - 1) // 2))


n = int(input())
for i in range(n):
	sum1 = 0
	(a, b) = map(int, input().split())
	for x in range(a, b, a):
		sum1 += x
	print(sum1)


T = int(input())
while T > 0:
	(X, N) = input().split()
	X = int(X)
	N = int(N)
	sum = 0
	for i in range(X, N, 1):
		if i % X == 0:
			sum = sum + i
	T = T - 1
	print(sum)


from math import floor as f
for _ in range(int(input())):
	(x, N) = list(map(int, input().split()))
	xx = x
	su = 0
	t = 1
	c = 1
	while x < N:
		su += x
		c += 1
		x = xx * c
	print(su)