Dangal with Shiva!

3

2 votes
Mathematics, Easy, Easy
Problem

Shiva is planning to watch movie Dangal with his friends (total M people). They all decide and choose row D of PVR (row D has total N seats) but each one of them books his own ticket individually. Every pair of friends sitting together orders one pack of popcorn. Each pack costs Rs 50. Find the expected amount W that Shiva and his friends will spend on popcorn.

INPUT:

First line contains a single integer T denoting the number of test cases. T lines follow, each containing two integers N and M.

OUTPUT:

Output the greatest integer less than or equal to W for each test case in separate lines.

CONSTRAINTS:

T <=100

1<=M<=N<=1000000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

There are 3 friends and 3 seats and thus only one way in which they can be seated and there are 2 pairs of friends sitting together and thus, buy 2 packs of popcorn.

Editor Image

?