With those kinds of numbers you don’t need logic anymore, just a lookup table with all possible states of the system.