{"raw_statement":[{"iden":"problem statement","content":"You are given a sequence $C$ of $N$ integers. Find the number of sequences $A$ of $N$ integers satisfying all of the following conditions.\n\n*   $1 \\leq A_i \\leq C_i\\, (1 \\leq i \\leq N)$\n*   $A_i \\neq A_j\\, (1 \\leq i < j \\leq N)$\n\nSince the count may be enormous, print it modulo $(10^9+7)$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq C_i \\leq 10^9$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$C_1$ $C_2$ $\\ldots$ $C_N$"},{"iden":"sample input 1","content":"2\n1 3"},{"iden":"sample output 1","content":"2\n\nWe have two sequences $A$ satisfying all of the conditions: $(1,2)$ and $(1,3)$.  \nOn the other hand, $A=(1,1)$, for example, does not satisfy the second condition."},{"iden":"sample input 2","content":"4\n3 3 4 4"},{"iden":"sample output 2","content":"12"},{"iden":"sample input 3","content":"2\n1 1"},{"iden":"sample output 3","content":"0\n\nWe have no sequences $A$ satisfying all of the conditions, so we should print $0$."},{"iden":"sample input 4","content":"10\n999999917 999999914 999999923 999999985 999999907 999999965 999999914 999999908 999999951 999999979"},{"iden":"sample output 4","content":"405924645\n\nBe sure to print the count modulo $(10^9+7)$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}