4 ms·If you didn’t care about the restrictions, then the answer is N*M choose 4.by tylerhou 5y agoIf you didn’t care about the restrictions, then the answer is N*M choose 4.