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

~/algor $ cat problems/case-inglizcha-tartib-son

English ordinal number

Medium 1000 ms 64 MB 46%
Share

In English, an ordinal number is written as digits with a suffix: 1st, 2nd, 3rd, 4th. Rule: if the number ends in $1$, add st; in $2$, add nd; in $3$, add rd; in any other digit, add th. But if the last two digits are $11$, $12$ or $13$, always add th: 11th, 12th, 113th. A positive integer $n$ is given. Print it as an ordinal number.

The suffixes of English ordinal numbers

Input

One positive integer $n$.

Output

The number and the suffix with no space, the suffix in lowercase (for example, 21st).

Note

$1 \le n \le 10^{9}$

Examples

Input #1
21
Output #1
21st
Input #2
12
Output #2
12th

Sign in to submit a solution

Signing up is free and takes a minute.