Implemented case1001.cc