Two cubes, each of volume 512 cm3 are joined end to end. Find the lateral and total surface areas of the resulting cuboid.