modified 271D.cpp