24 J of heat are added to a gas in a container, and then the gas does 6 J of work on the walls of the container. What is the change in internal energy for the gas?

a) 30 J

b) 18 J

c) 4 J

d) 18 J

e) 30 J