C - Shahhoud Training Hussain(SDUT 2018 Autumn Individual Contest - F)

滴答滴答---题目链接 

Ever since coach Shahhoud started the series "Problem Every Day" . Hussain decided to train really hard. After all, he may get a chance to qualify for the upcoming SCPC contest !

Shahhoud gives Hussain K problems everyday. However, Hussain can solve at most P problems everyday.

At the end of the Nth day of training, Shahhoud wants to know how many problems did Hussain miss and hasn't solved yet?

Input

The first line contains an integer T, the number of test cases.

Each line of the following T lines describes a single test case. Each test case contains 3 space separated integers K, P, N (1 ≤ K, P, N ≤ 109).

Output

For each test case print a single line, containing a single integer, denoting the number of problems Hussain has missed by the end of the Nth day.

Example

Input

3
2 1 3
4 1 10
3 2 1

Output

3
30
1
#include 
#include
using namespace std;

int main()
{
    int t;
scanf("%d",&t);
    while(t--)
    {
        long long  int k,p,n;
        scanf("%lld%lld%lld",&k,&p,&n);
        p=p*n;
        k=k*n;
        long long ans=k-p;
        if(ans<0)
            ans=0;
        printf("%lld\n",ans);
    }
    return 0;
}

 

你可能感兴趣的:(VJ)