Added coefficient handling for reverse polish notation