function getPow(x,n:byte):integer;
var res,i:integer;
begin
res:=1;
for i:=1 to n do
res:=res*x;
getPow:=res;
end;
var s1,s2: integer;
i: byte;
begin
s1:=0;
s2:=0;
for i:=1 to 3 do
s1:=s1+getPow(i+2,3);
for i:=3 to 6 do
s2:=s2+getPow(i-1,3);
write('s = ',s1+2*s2);
readln;
end.