Bobo is organizing a marathon contest. The contest contains n checkpoints which are conveniently labeled with 1,2,…,n. You are given a binary matrix G. In this matrix, G_u,v=1 indicates that there is a directed road from checkpoint u to checkpoint v, and G_u,v=0 means there is no such road.
There are m players. The i-th player starts at checkpoint v_i at moment t_i. As the road system is complicated, players behave quite randomly. More precisely, if at moment t a player is at checkpoint u, at moment (t+1) this player will appear at any checkpoint v such that G_u,v=1 with equal probability.
Let E_t=P⋅Q−1mod(109+7) where QP is the expected number of players at checkpoint n at moment t, and Q⋅Q−1≡1mod(109+7). Bobo would like to know E_1⊕E_2⊕⋯⊕E_T. Note that "⊕" denotes bitwise exclusive-or.
The first line contains three integers n, m and T (1≤n≤70, 1≤m≤104, 1≤T≤2⋅106).
The i-th of the following n lines contains a binary string G_i,1,G_i,2,…,G_i,n of length n. It is guaranteed that G_i,i=1 is always true.
The i-th of the last m lines contains two integers t_i and v_i (1≤t_1<t_2<⋯<t_m≤T, 1≤v_i≤n).
Output an integer which denotes the result.