P001: use reduce method for better understanding