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
Romal Thoppilan: 2012-09-15 16:00:47

Their can be multiple ways to represent a number in roman numerals ... does your system accept all of those

himanshu jain: 2012-09-15 16:00:47

IV, IX, CM are valid

Darko Aleksic: 2012-09-15 16:00:47

Also - being that I submit mainly in Java, the sub-1s and source code limits just tick me off. Especially if a problem is not really about optimization (like this one).

Darko Aleksic: 2012-09-15 16:00:47

What is a "Roman system"? Are you using a definition available online? If yes, please provide the link, if not, please define it in the problem statement.
E.g. - are these valid in this system: IV, IX, CM? (assuming that IVXCM are valid symbols). That sort of thing.


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