int magicalWell(int a, int b, int n) { var sum = 0; while (n != 0) { sum += a * b; a++; b++; n--; } return sum; }