Dynamic programming/Expected value/Bitmask dp