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
2022-09-10 23:09:48 vas14
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.
2013-06-06 05:32:45 Mostafa 36a2
SILLY is my code name :D
easy one ..tfG
2013-01-10 00:03:14 Haijun Deng
Please notice CMXCIX=999
2013-01-06 21:10:51 Man Mohan Mishra
Thanks francky for the link...
got AC in first attempt !!
2012-12-31 07:05:53 Pranshul Agarwal
After so many silly mistakes finally AC.... :D
2012-12-27 12:42:20 Vikas Kushwaha
after so many WA
got it AC
aaahhhh...silly mistakes.
2012-12-24 16:21:37 Snehasish Roy ;)
Thanks Francky for the link :)

Last edit: 2012-12-24 19:01:48
2012-09-24 08:25:53 Adhityaa
Time Limit is 0.119 s ?! What's special about 0.119 s
2012-09-15 16:00:47 winner
do we have to read untill EOF ????
2012-09-15 16:00:47 (Tjandra Satria Gunawan)(曾毅昆)
Silly mistake, finally AC after 10 WA...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.