solved problems with divide and query