You need to define the model for your case:
How the wall will be deformed and how much enegy will be loss duing collision and what that will affect later collision.

It will be easier to modify it from [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=632.0]EJS version of ideal gas law: PV=nRT [/url]