Exercise 4.3: digital switch

before
after