There are some caps in a box. 1/6 of them are red, 1/3 are blue, and 3/7 of the remainder are green. If there are 27 green caps, how many caps are there altogether.