Solving mathematical problems on touch-based devices