Logo
(追記) (追記ここまで)

16846번 - Hyperrectangle 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB73372847.458%

문제

Snuke received a d-dimensional hyperrectangle of size l1 × · · · × ld as a birthday present. Snuke placed it such that its i-th coordinate becomes between 0 and li, and ate the part of the hyperrectangle that satisfies x1 + · · · + xd ≤ s. (Here xi denotes the i-th coordinate). Let V be the volume of the part eaten by Snuke. We can prove that d!V (V times the factorial of d) is always an integer. Compute d!V modulo 109 + 7.

입력

First line of the input file contains one integer d (2 ≤ d ≤ 300). Then d lines follow; i-th of these lines contain one integer li (1 ≤ li ≤ 300). Last line contains one integer s (0 ≤ s ≤ Σli).

출력

Print d!V modulo 109 + 7.

제한

예제 입력 1

2
6
3
4

예제 출력 1

15

예제 입력 2

5
12
34
56
78
90
123

예제 출력 2

433127538

힌트

Illustration to Sample 1:

출처

Contest > ICPC Japanese Alumni Group > JAG Summer Camp > JAG Summer Camp 2014 Day 2 J번

Camp > Petrozavodsk Programming Camp > Winter 2015 > Day 2: Makoto Soejima Contest 1, Japanese Grand Prix J번

Contest > Open Cup > 2014/2015 Season > Stage 6: Grand Prix of Japan J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /