#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
long long solution(int price, int money, int count) {
long long answer = -1;
long long i;
long long sum = 0;
for(i=1;i<=count;i++)
{
sum = sum + price * i;
}
if(sum - money<=0)
{
answer = -sum + money;
}
else
{
answer = sum - money;
}
return answer;
}