modified some code for solving v1&v2