set stack [list]
while {1} {
    set line [gets stdin]
    foreach x [split $line " "] {
        if {[regexp {^\d+\.?\d*$} $x]} {
            lappend stack $x
        } else {
            if {[llength $stack] < 2} {
                error "Not enough operands on stack for $x"
            }
            set a [lindex $stack end-1]
            set b [lindex $stack end]
            set stack [concat \
                [lrange $stack 0 end-2]\
                [list [expr "\$a $x \$b"]]]
        }
    }
    puts [lindex $stack end]
}

