LearnPy Hub
← Variables problems
Hard

Swap the First and Last Digit

Read an integer with exactly 4 digits. Using only arithmetic (no strings), swap its first and last digits and print the new number (it may start with 0, so print it as a number: 4560 becomes 564).

Input

One integer 1000–9999.

Output

One integer.

Sample 1

Input
1234
Output
4231

Sample 2

Input
4560
Output
564
solution.py
Output appears here
Swap the First and Last Digit · Python practice problem · LearnPy Hub