(long x, long p)
| 50 | public static long ans1, ans2; |
| 51 | |
| 52 | public static long power(long x, long p) { |
| 53 | long ans = 1; |
| 54 | while (p != 0) { |
| 55 | if ((p & 1) != 0) { |
| 56 | ans = ans * x % MOD; |
| 57 | } |
| 58 | p >>= 1; |
| 59 | x = x * x % MOD; |
| 60 | } |
| 61 | return ans; |
| 62 | } |
| 63 | |
| 64 | public static void addEdge1(int u, int v, int w, int c) { |
| 65 | next1[++cnt1] = head1[u]; |