@tarun - google pe search karo bhai. there are methods to do that. simple methods.
A = (0,1,2,3,4,5,6) mod 7.
B = (0,1,2,3,4,5,6) mod 7.
so total ways to select A and B = 7*7 = 49.
favourable cases are (0,0), (1,6), (2,5), (3,4), (4,3), (5,2), (6,1).
agey khud karlo.
i think this must be the way..