ROMAN008 - ROMAN NUMERALS

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

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

hide comments
2012-09-15 16:00:47 Romal Thoppilan
Their can be multiple ways to represent a number in roman numerals ... does your system accept all of those
2012-09-15 16:00:47 himanshu jain
IV, IX, CM are valid
2012-09-15 16:00:47 Darko Aleksic
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).
2012-09-15 16:00:47 Darko Aleksic
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.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.