Program Tinh_tong;
Var n, x, i, S : Integer;
Begin
Write ('Hay nhap n la : '); Readln (n);
i := 0; S := 0;
While i < n do
Begin
i := i + 1;
Write ('Nhap so thu ',i,' = '); Readln (x);
if x mod 3 = 0 then S := S + x;
End;
Writeln ('Tong cac so chia het cho 3 la : ',S);
Readln
End.