add solution of m3 in java