A pen and pencil have a total cost of $6. If the pen costs twice as much as the pencil, what is the cost of the pen?