to calculate reverse polish fomula