Some unit cubes are assembled to form a larger cube. Some of the faces of the larger cube are then painted. The cube is taken apart and it is found that 217 of the unit cubes have paint on them. What is the total number of unit cubes?