Jiřina has a four-digit number written on a piece of paper. If she swaps the digits in the hundreds and units places and adds this new number to the original number, she gets a result of 3332. However, if she swaps the digits in the thousands and tens places and adds this number to the original, she gets a result of 7886. Determine what number Jiřina had written on the paper.

(E. Novotná)