System.in.eachLine{println it.split()[1,0].combinations()*.reverse()*.sum().join(' ')}