25 lines
378 B
C
25 lines
378 B
C
|
#include <stdio.h>
|
||
|
|
||
|
int main(void) {
|
||
|
// Initialize variables and get input
|
||
|
long long sum = 0;
|
||
|
long long n;
|
||
|
scanf("%lld", &n);
|
||
|
|
||
|
// if n is smaller than 3
|
||
|
if (n < 3) {
|
||
|
printf("0");
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
// Iterate through all
|
||
|
for (long long i = 3; i < n; i++) {
|
||
|
sum += i * (i - 1) * (i - 2);
|
||
|
}
|
||
|
|
||
|
// Print the result
|
||
|
printf("%lld\n", sum);
|
||
|
|
||
|
return 0;
|
||
|
}
|