completed P solver, but getting neg vals