Tree queries
You are given a connected graph with vertexes and edges. In other words, you are given a tree. Vertex is the root of the tree. In vertex there is an integer written on it. Let's define cost of the tree as XOR
sum of all its values. You were given queries, containing two integers and . Each query makes = , where belongs to the subtree of the vertex and denotes XOR
operation. As we all know, this problem can be easily solved by our participants, but if all was that easy, this problem wouldn't appear at this Olympiad. You know that some queries were changed by angry Anton. Thus, you are asked to find the sum of costs modulo , of all trees that can be obtained by applying some (possibly none) queries on the tree.
Input
The first line of input contains two integers () and () — number of vertexes in the tree and number of queries accordingly.
The second line of input contains integers () — values written on the vertex of the tree.
The following lines contain two integers and each — edges of the given tree.
The following lines contain two integers () and () each — description of queries.
Output
Print one integer in the first line — answer to the problem.
Examples
Scoring
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): no additional restrictions.