<>;$/=$";@a=0+<>;@a=(sort{$b<=>$a}map{map{int eval}<$_ {+,-,\\*,/}\$'>}@a)[0,-//]for<>;printf@a