solve for vn.spoj problems