Parenthesize an expression Recently I've been writing a new language, to avoid needing to handle order of operations, I simply parenthesize each expression properly to avoid this entirely. 

Because parenthesis are at char-codes 40-41, your code will need to be as short as possible.



Examples

1+2*3
(1+(2*3))

2*(3+4)
(2*(3+4))

2*3/4+3
(((2*3)/4)+3)

342*32/8
((342*32)/8)


Rules

The only operations you'll need to handle are: * (multiplication), / (division), + (addition), and - (subtraction).


The order of operations is:


Parenthesis
Multiplication, Division
Adition, Subtraction

You should prefer to go left-right
The input numbers will always be positive integers (see bonuses)


Bonuses

-20% if you handle negation:

3+-5
(3+(-5))


-5% if you allow spaces to be placed inside the input:

3  + 4
(3+4)


-10% if you can handle decimals in the input:

1+.12
(1+.12)
1+0.21/3
(1+(0.21/3))


500 bounty: if you manage to write an answer in Unnamed/Blocks
JavaScript (ES6) 179 (263 -20% -5% -10%)
(x,W=[],Q=['('],z=1,w=v='',h=p=&gt;'*/+-))('.indexOf(p)|1,C=n=&gt;{for(;h(q=Q.pop())&lt;=h(n);)W[0]=`(${W[1]+q+W.shift()})`;z&amp;&amp;Q.push(q,n)})=&gt;(x+')').replace(/[\d.]+|\S/g,t=&gt;t&gt;'('?t&gt;')'?~h(t)?z?(w+='('+t,v+=')'):C(t,z=1):W=[w+t+v,...W,z=w=v='']:C(t,z=0):z=Q.push(t))&amp;&amp;W[0]

As the other two answers are currently both wrong, I'll post mine. It's a variation of the expression parser that I used here and here and somewhere else. Look there for more detailed algorithm explanations.
It's quite bulky but it should work.
Test snippet


f=(x,W=[],Q=['('],z=1,w=v='',h=p=&gt;'*/+-))('.indexOf(p)|1,C=n=&gt;{for(;h(q=Q.pop())&lt;=h(n);)W[0]=`(${W[1]+q+W.shift()})`;z&amp;&amp;Q.push(q,n)})=&gt;(x+')').replace(/[\d.]+|\S/g,t=&gt;t&gt;'('?t&gt;')'?~h(t)?z?(w+='('+t,v+=')'):C(t,z=1):W=[w+t+v,...W,z=w=v='']:C(t,z=0):z=Q.push(t))&amp;&amp;W[0]

// More readable
x=(x,W=[],Q=['('],z=1,w=v='',
  h=p=&gt;'*/+-))('.indexOf(p)|1,
  C=n=&gt;{
    for(;h(q=Q.pop())&lt;=h(n);)W[0]=`(${W[1]+q+W.shift()})`;
    z&amp;&amp;Q.push(q,n)
  }
)=&gt;(
  (x+')')
  .replace(/[\d.]+|\S/g,t=&gt; 
       t&gt;'('    
       ?t&gt;')'
       ?~h(t)
       ?z
       ?(w+='('+t,v+=')')
       :C(t,z=1)
       :W=[w+t+v,...W,z=w=v=''] // overfill W to save 2 chars ()
       :C(t,z=0)
       :z=Q.push(t)
  ),
  W[0]
)

console.log=(...x)=&gt;O.textContent+=x.join` `+'\n'

// TEST
;[
  ['1+2*3','(1+(2*3))'],['2*(3+4)','(2*(3+4))'],['2*3/4+3','(((2*3)/4)+3)'],['342*32/8','((342*32)/8)'],
  ['3+-5','(3+(-5))'],['-3+-4*7','((-3)+((-4)*7))'], // bonus 20%
  ['3  + 4','(3+4)'], // bonus 5%
  ['1+.12','(1+.12)'],['1+0.21/3','(1+(0.21/3))'] // bonus 10%
].forEach(t=&gt;{var k=t[1],i=t[0],r=f(i); console.log(i+' : '+r+(r==k? ' OK':' Fail expecting '+k))})
&lt;pre id=O&gt;&lt;/pre&gt;