How to bind mouse 4 and 5

I want to bind mouse 4 to the pencil tool and mouse 5 to eraser but it is not letting me, how can i do this?