Added solution to q4-reduce