{"raw_statement":[{"iden":"problem statement","content":"You are given an integer sequence $A=(A_1,\\ldots,A_N)$ and positive integers $a$, $b$, and $c$.\nYou can perform the following operation on this sequence any number of times, possibly zero.\n\n*   Choose an integer $i$ such that $1\\leq i\\leq N$. Replace $A_i$ with $A_i+1$.\n\nYour objective is to make the sequence $A$ contain at least one multiple of $a$, at least one multiple of $b$, and at least one multiple of $c$. Find the minimum number of operations required to achieve this objective."},{"iden":"constraints","content":"*   $1\\leq N\\leq 2\\times 10^5$\n*   $1\\leq a, b, c \\leq 10^6$\n*   $1\\leq A_i\\leq 10^{18}$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $a$ $b$ $c$\n$A_1$ $\\cdots$ $A_N$"},{"iden":"sample input 1","content":"3 3 4 5\n8 9 11"},{"iden":"sample output 1","content":"2\n\nYou can perform the operation twice so that $A = (8,10,12)$ to achieve the objective."},{"iden":"sample input 2","content":"3 3 4 5\n14 11 59"},{"iden":"sample output 2","content":"1\n\nYou can perform the operation once so that $A = (14,11,60)$ to achieve the objective."},{"iden":"sample input 3","content":"6 10 20 30\n8 17 5 28 39 13"},{"iden":"sample output 3","content":"3\n\nYou can perform the operation three times so that $A = (8,17,5,30,40,13)$ to achieve the objective."},{"iden":"sample input 4","content":"1 999997 999998 999999\n123456789123456789"},{"iden":"sample output 4","content":"876537210887543205\n\nYou can perform the operation $876537210887543205$ times so that $A = (999994000010999994)$ to achieve the objective."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}