give string formula represent chemical formula return count atomthe atomic element start uppercase character zero lowercase letter represent nameone digit represent element count follow count great 1 if count 1 digit followfor example H2O H2O2 possible H1O2 impossibleTwo formula concatenate produce formulafor example H2O2He3Mg4 formulaA formula place parenthesis count optionally add formulaFor example H2O2 H2O23 formulasreturn count element string follow form sort order follow count count 1 follow second sorted order follow count count 1 onthe test case generate value output fit 32bit integer Example 1input formula h2ooutput h2oexplanation the count element h 2 o 1example 2input formula MgOH2Output H2MgO2Explanation the count element h 2 Mg 1 o 2example 3input formula k4onso322output k4n2o14s4explanation the count element k 4 n 2 o 14 s 4 Constraints1 formulalength 1000formula consist english letter digit formula valid