Let S be the set of all real 3×3 matrices A=[aij] in which each of the nine entries aij is either 1 or −1. The set S has 29=512 members, so detA takes only finitely many values on S. Let M be the largest value of detA as A runs over all matrices in S. A student notes that each row of A has length 3 when viewed as a vector in R3. What is the exact value of M?