An open box is formed by cutting a 5 inch square measured from each corner and folding up the sides. If the volume of the carton is then 40 in3, what was the length of a side of the original square of cardboard?