function solution(price, money, count) { var answer = -1; let wallet=money; for(let i=1;i<=count;i++){ wallet-=price*i; } if(wallet>0) answer=0; else{ answer=wallet*-1; } return answer; }