#incldue <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,t;
cin>>n;
t=0;
for (i=1; i<=n-1; i++)
if (i%3==0) t+=i;
cout<<t;
}
program BT;
uses crt;
Var m, n, i, T:Bytbe;
begin
clrscr;
Write( 'Nhap m: ' );Readln(m);
Write( ' Nhap n: ' );Readln(n);
T:=0;
For i:=m to n do
If i mod 3=0 then T:=T+1;
Writeln( ' Tong la: ' ,T);
readln;
end.