I,V,X,L,C,D,M=1,5,10,50,100,500,1000;e=eval while 1: s=raw_input();t=s[-1] for c in s[-2::-1]: t+='+-'[e(c)