you n friend want m picture exactly friend appear picture picture contain pair friend so n3 friend 3 different picture contain pair friendseach friend attractiveness level specify integer number ai ith friend you know attractiveness picture contain ith jth friend equal exclusiveor xor operation integer ai ajyou want picture way total sum attractiveness picture maximize you calculate value since result fit 32bit integer number print modulo 1000000007 1097