Optimal design of Purcell's three-link swimmer