Program Perfect (Input,Output);

VAR
   N, F, Sum : Integer;

BEGIN
   N := 3;
   WHILE N < 500 DO
    BEGIN
      Sum := 1;
      F := 2;
      WHILE F <= N DIV 2 DO
        BEGIN
          IF N MOD F = 0 THEN
            Sum := Sum + F;
          F := F + 1;
        END;
      IF Sum =  N THEN
         Writeln(N,' is a perfect number');
      N := N + 1;
    END;
END.