#include #define ALL(v) std::begin(v),std::end(v) using lint=long long; using lubl=long double; void debug_impl(){std::cerr<<'\n';} templatevoid debug_impl(Head head, Tail... tail){std::cerr << " " << head;debug_impl(tail...);} template::value,std::nullptr_t> = nullptr> std::ostream&operator<<(std::ostream&os,Container const&v) {os<<"{";for(auto it=v.begin();it!=v.end();it++){os<<(it!=v.begin()?",":"")<<*it;}return os<<"}";} templateclass Tuple,class...Args,std::size_t...Inds,std::size_t=std::tuple_size>::value> std::ostream&tuple_output_impl(std::ostream&os,const Tuple&tuple,std::integer_sequence) {os<<"(";(void)std::initializer_list{((void)(os<<(Inds>0?",":"")<(tuple)),0)...};return os<<")";} templateclass Tuple,class...Args,std::size_t=std::tuple_size>::value> std::ostream&operator<<(std::ostream&os,const Tuple&tuple) {return tuple_output_impl(os,tuple,std::index_sequence_for());} #define DEBUG 1 #if DEBUG #define debug(...)do{std::cerr<roman{ "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", }; auto toroman=[&](lint x){ std::string ans; for(lint i=3;i>=0;i--){ lint j=x; for(lint k=0;ktable(4000); for(lint i=1;i<4000;i++){ table.at(i)=toroman(i); } lint n;std::cin>>n; lint ans=0; while(n--){ std::string s;std::cin>>s; ans+=std::find(ALL(table),s)-table.begin(); } if(4000<=ans){ std::cout<<"ERROR"<<'\n'; return 0; } std::cout<