ex1 is basically a factorial server