Mastering Word Problems in P4 Learning