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 :D
I think it's good enough for an easy classical. Also thanks for the link Francky. It should be added the the problem description.
2012-09-15 16:00:47 numerix
60 + 15 = 75
2012-09-15 16:00:47 accept
thanx

Last edit: 2012-08-18 22:04:22
2012-09-15 16:00:47 Francky
I think there's no blank line in the input, and we do not have to put some in the output. I did like that, and AC.
2012-09-15 16:00:47 mehmetin
Is there a blank line between each output? (but not after the last)?
2012-09-15 16:00:47 Francky
I use those rules to get AC.
http://projecteuler.net/about=roman_numerals
2012-09-15 16:00:47 numerix
@problemsetter: There is definitely not one standard way. Wikipedia says: "There has never been a universally accepted set of rules for Roman numerals. Because of this lack of standardization, there may be multiple ways of representing the same number in Roman numerals. For example, the United States National Institute of Standards and Technology could find no authority that could describe if the year 1999 should be written as MDCCCCLXXXXVIIII, MCMXCIX, or MIM."
Anyway: Problem should be moved to tutorial.

Last edit: 2012-08-17 18:47:29
2012-09-15 16:00:47 himanshu jain
language restriction removed
2012-09-15 16:00:47 Francky
I don't understand time limit and language restrictions. Please explain. I find it very curious !!!
EDIT : Thanks for having open to more languages.
And like numerix, I think this problem belongs to tutorial.

Last edit: 2012-08-17 18:52:29
2012-09-15 16:00:47 himanshu jain
there are not multiple ways in MODERN numeral system
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.