RETO2M10 - 2RETO 10 MARATON

Roman number is very useful number system. Often we need to convert a decimal number into Roman number. In Roman number the following symbol are used: I, V, X, L, C, D, M for 1, 5, 10, 50, 100, 500 and 1000 respectively.

Input

Quantity of decimal numbers to convert to Roman and each of the decimal system numbers.

Output

Roman number equivalent.

Example

Input:
4
15
245
455
690

Output:
XV
CCXLV
CDLV
DCXC
Input:
2
18
345

Output:
XVIII
CCCXLV
Input:
3
500
124
248

Output:
D
CXXIV
CCXLVIII

Added by:MARATON AFDM
Date:2015-09-28
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:MAWK BC C NCSHARP CSHARP C++ 4.3.2 COFFEE DART FORTH JAVA JS-RHINO JULIA KTLN NODEJS OCT PHP PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA

hide comments
2018-10-12 20:14:20
Output examples are wrong; do not read til EOF, instead take first integer n as number of cases and convert only n following integers. Wasted half an hour to get to this, here's a bitchslap to the psetter as well as those who got AC but didn't bother to point this out.

Integers are in <1, 3999> range.

[Simes]: fixed the examples.

Last edit: 2023-04-29 22:54:18
2015-09-28 13:49:01 wisfaq
unnecessary language restrictions.
tutorial problem?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.