var k, sum, i:Integer;
begin
sum:=0;
readln(k);
for i := 1 to k do
if (i mod 3 = 0)then
sum:=sum+i;
end;
writeln(sum);
end.
var k, sum, i:Integer;
begin
sum:=0;
readln(k);
for i := 1 to k do
begin
if (i mod 3 = 0)then
sum:=sum+i;
end;
writeln(sum);
end.