{"raw_statement":[{"iden":"problem statement","content":"You are given an integer sequence $A=(A_1,A_2,\\cdots,A_N)$ of length $N$, and another integer sequence $P=(P_2,\\cdots,P_N)$ of length $N-1$. Note that the index of $P$ starts at $2$. It is guaranteed that $1 \\leq P_i < i$ for each $i$.\nYou will now repeat the following operation $10^{100}$ times.\n\n*   For each $i=2,\\cdots,N$, in this order, replace the value of $A_{P_i}$ with $A_{P_i}+A_{i}$.\n\nDetermine whether $A_1$ will be positive, negative, or zero when all operations are completed."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 250000$\n*   $-10^9 \\leq A_i \\leq 10^9$\n*   $1 \\leq P_i < i$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\cdots$ $A_N$\n$P_2$ $\\cdots$ $P_N$"},{"iden":"sample input 1","content":"4\n1 -2 3 -4\n1 2 3"},{"iden":"sample output 1","content":"\\-\n\nShown below are the results of the first few operations.\n\n*   After the first operation:\n    *   Before the operation: $A=(1,-2,3,-4)$.\n    *   Processing for $i=2$: Replace the value of $A_1$ with $A_1+A_2=1+(-2)=-1$.\n    *   Processing for $i=3$: Replace the value of $A_2$ with $A_2+A_3=-2+3=1$.\n    *   Processing for $i=4$: Replace the value of $A_3$ with $A_3+A_4=3+(-4)=-1$.\n    *   After the operation: $A=(-1,1,-1,-4)$.\n*   After the second operation, $A=(0,0,-5,-4)$.\n*   After the third operation, $A=(0,-5,-9,-4)$.\n*   After the fourth operation, $A=(-5,-14,-13,-4)$.\n*   $\\vdots$\n\nAfter $10^{100}$ operations, $A_1$ will be negative. Thus, you should print `-`."},{"iden":"sample input 2","content":"3\n0 1 -1\n1 1"},{"iden":"sample output 2","content":"0"},{"iden":"sample input 3","content":"5\n1 -1 1 -1 1\n1 1 2 2"},{"iden":"sample output 3","content":"+"},{"iden":"sample input 4","content":"20\n568273618 939017124 -32990462 -906026662 403558381 -811698210 56805591 0 436005733 -303345804 96409976 179069924 0 0 0 -626752087 569946496 0 0 0\n1 1 1 4 4 6 7 2 2 3 3 8 13 14 9 9 15 18 19"},{"iden":"sample output 4","content":"+"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}