Homework 3 for CS184