아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Random XOR

시간 제한1초메모리 제한256 MB

요약
각 원소를 독립적으로 확률 X/Y로 남길 때, 남은 원소들의 XOR 제곱의 기댓값을 1e9+7로 나눈 나머지를 구한다.
난이도

보통10점 중 7점

유형
확률, 수학, 비트 연산, 동적 계획법
정답자
아직 제출이 없습니다

문제

There is an array aa containing nn integers. Also, there is initially empty array bb. Some elements of aa are going to be added to bb. Each element is added with probability PP independently from others. Then the value of ss is to be computed: s=⊕_i=0∣b∣b_is = \oplus\_{i = 0}^{|b|} b\_{i} where ⊕\oplus is bitwise exclusive OR (if the array bb is empty, ss equals to zero). You are required to compute the expected value of s2s^{2}.

입력

The first line of input contains three integers nn, XX and YY. The probability PP is equal to XY\frac{X}{Y}.

The second line contains nn integers a_ia\_{i} divided by spaces --- elements of the array aa.

출력

The answer can be always represented as a fraction uv\frac{u}{v} where uu and vv are co-prime numbers and v≠0mod  (109+7)v \neq 0 \mod (10^9+7) You are required to output only one number --- u×v−1mod  (109+7)u \times v^{-1} \mod (10^9+7)

제한

  • 1≤n≤1051 \le n \le 10^5
  • 0≤X<109+70 \le X < 10^9+7
  • 0<Y<109+70 < Y < 10^9+7
  • X≤YX \le Y
  • 0≤a_i<109+70 \le a\_i < 10^9+7

예제1

  1. 예제 1

    입력
    3 1 2
    2 8 10
    
    예상 출력
    42