Task 12 in Pascal (32-bit integers)