Change code of calc to reverse input