ROMAN008 - ROMAN NUMERALS

no tags 

You are given two numbers in Roman system (modern Roman Numerals) and an operator. Output is the result in Roman system.

Input

You are given two space separated numbers in roman system and after space an operator on the same line. Operator can be +, -, /, *, %.

Numbers a, b: 1 <= a, b<5000

eg: 4000=MMMM, for numbers >=4000, you should use MMMM.....

for others as per definition.

Input consists of 5 testcases.

Output

Output is the result < 5000 of performing the operation. Print on a separate line

Example

Input:
LX XV +
X V *

Output:
LXXV
L

hide comments
vas14: 2022-09-10 23:09:48

I'd ignore the projecteuler link given below, the judge for this problem will reject some of the roman numerals deemed legal by that link. Aim for the shortest possible numeral.

Mostafa 36a2: 2013-06-06 05:32:45

SILLY is my code name :D
easy one ..tfG

Haijun Deng: 2013-01-10 00:03:14

Please notice CMXCIX=999

Man Mohan Mishra: 2013-01-06 21:10:51

Thanks francky for the link...
got AC in first attempt !!

Pranshul Agarwal: 2012-12-31 07:05:53

After so many silly mistakes finally AC.... :D

Vikas Kushwaha: 2012-12-27 12:42:20

after so many WA
got it AC
aaahhhh...silly mistakes.

Snehasish Roy ;): 2012-12-24 16:21:37

Thanks Francky for the link :)

Last edit: 2012-12-24 19:01:48
Adhityaa: 2012-09-24 08:25:53

Time Limit is 0.119 s ?! What's special about 0.119 s

winner: 2012-09-15 16:00:47

do we have to read untill EOF ????

(Tjandra Satria Gunawan)(曾毅昆): 2012-09-15 16:00:47

Silly mistake, finally AC after 10 WA...


Added by:himanshu jain
Date:2012-08-17
Time limit:0.100s
Source limit:2000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: FSHARP JS-RHINO
Resource:own problem