{"problem":{"name":"Please Sign","description":{"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 ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc169_a"},"statements":[{"statement_type":"Markdown","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.\n\n## Constraints\n\n*   $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.\n\n## Input\n\nThe 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$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc169_a","tags":[],"sample_group":[["4\n1 -2 3 -4\n1 2 3","\\-\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 `-`."],["3\n0 1 -1\n1 1","0"],["5\n1 -1 1 -1 1\n1 1 2 2","+"],["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","+"]],"created_at":"2026-03-03 11:01:14"}}