import java.util.Stack;

public class CalcD {
	static Operand op;
	static Stack st;
	static Adder ad;
	static ResultPresenter rp;
	
	public static void main(String [] argv){
		op = new Operand();
		st = new Stack();
		ad = new Adder();
		rp = new ResultPresenter();
		
		op.addDigit('1'); 	op.addDigit('2');
		op.complete();
		op.addDigit('2'); 	op.addDigit('4');
		op.complete();
		
		ad.operate();
		rp.operate();
		}
	}
	

class Operand{
	public StringBuffer buf;

	public Operand(){ buf = new StringBuffer(14); }
	public void addDigit(char ch){buf.append(ch);}  

	public void deleteLastDigit(){
		String s =new String(buf);
		buf = new StringBuffer(s.substring(0, 
s.length()-1));
		}
	
	public void reset(){
		buf = new StringBuffer(14);
		}	 

	public void set(double val){ 
		reset(); 	buf.append(val);
		}

	public void complete(){      
		Double d = new Double(buf.toString());
		CalcD.st.push(d); 
		reset();
		}
	}
	
	
class Adder {
	public void operate() {
		Double d1 = (Double)CalcD.st.pop();
		Double d2 = (Double)CalcD.st.pop();
		CalcD.st.push(new Double(d1.doubleValue() + 
d2.doubleValue()));
		}
	}
	
	
class ResultPresenter {
	public void operate() {
		System.out.println((Double)CalcD.st.pop());
		}
	}
