{"problem":{"name":"Insurance","description":{"content":"Snuke has read his own fortune for tomorrow, and learned that there are $N$ scenarios that can happen, one of which will happen tomorrow with equal probability. The $i$\\-th scenario will cost him $A_i","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc122_b"},"statements":[{"statement_type":"Markdown","content":"Snuke has read his own fortune for tomorrow, and learned that there are $N$ scenarios that can happen, one of which will happen tomorrow with equal probability. The $i$\\-th scenario will cost him $A_i$ yen (Japanese currency).\nFollowing this, Snuke has decided to get insurance today. If he pays $x$ yen to his insurance company, he will get compensation of $\\min(A_i,2x)$ yen when $A_i$ yen is lost. Here, he can choose any non-negative **real number** as $x$.\nSnuke wants to minimize the expected value of the amount of money he loses, which is $x+A_i-\\min(A_i,2x)$. Find the minimized value.\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^5$\n*   $1 \\leq A_i \\leq 10^9$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\cdots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc122_b","tags":[],"sample_group":[["3\n3 1 4","1.83333333333333333333\n\nThe optimum choice is $x=1.5$. After paying $1.5$ yen, one of the following three scenarios will happen with equal probability:\n\n*   Scenario $1$: Lose $3$ yen and get compensation of $\\min(3,2x)=3$ yen. After all, Snuke loses $x+A_1-\\min(A_1,2x)=1.5+3-3=1.5$ yen.\n    \n*   Scenario $2$: Lose $1$ yen and get compensation of $\\min(1,2x)=1$ yen. After all, Snuke loses $x+A_2-\\min(A_2,2x)=1.5+1-1=1.5$ yen.\n    \n*   Scenario $3$: Lose $4$ yen and get compensation of $\\min(4,2x)=3$ yen. After all, Snuke loses $x+A_3-\\min(A_3,2x)=1.5+4-3=2.5$ yen.\n    \n\nThus, the expected amount of money lost is $(1.5+1.5+2.5)/3=1.833333\\cdots$ yen."],["10\n866111664 178537096 844917655 218662351 383133839 231371336 353498483 865935868 472381277 579910117","362925658.10000000000000000000"]],"created_at":"2026-03-03 11:01:14"}}