Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/integer-chetki-raqamlarni-almashtirish

Swap the outer digits

Medium 1000 ms 64 MB 36%
Share

A four-digit positive integer $n$ is given. Find the number obtained by swapping its first and last digits: $1234$ gives $4231$. Leading zeros of the result are not written: for example, $1230$ gives $231$.

The first and fourth digits of the four-digit number swap places

Input

One four-digit positive integer $n$.

Output

One integer — the number with swapped outer digits.

Note

$1000 \le n \le 9999$

Examples

Input #1
1234
Output #1
4231
Input #2
1230
Output #2
231

Sign in to submit a solution

Signing up is free and takes a minute.