Arithmetic problems in js