P01, P02 in scala