{"problem":{"name":"A. Binary Protocol","description":{"content":"Polycarp has just invented a new binary protocol for data transmission. He is encoding positive integer decimal number to binary string using following algorithm: *   Each digit is represented with n","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF825A"},"statements":[{"statement_type":"Markdown","content":"Polycarp has just invented a new binary protocol for data transmission. He is encoding positive integer decimal number to binary string using following algorithm:\n\n*   Each digit is represented with number of _'1'_ characters equal to the value of that digit (for _0_ it is zero ones).\n*   Digits are written one by one in order corresponding to number and separated by single _'0'_ character.\n\nThough Polycarp learnt how to encode the numbers, he has no idea how to decode them back. Help him calculate the decoded number.\n\n## Input\n\nThe first line contains one integer number _n_ (1 ≤ _n_ ≤ 89) — length of the string _s_.\n\nThe second line contains string _s_ — sequence of _'0'_ and _'1'_ characters, number in its encoded format. It is guaranteed that the number corresponding to the string is positive and doesn't exceed 109. The string always starts with _'1'_.\n\n## Output\n\nPrint the decoded number.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"Polycarp 刚刚发明了一种用于数据传输的新二进制协议。他使用以下算法将正整数的十进制数编码为二进制字符串：\n\n尽管 Polycarp 学会了如何编码数字，但他不知道如何将其解码回来。请帮助他计算出解码后的数字。\n\n第一行包含一个整数 #cf_span[n]（#cf_span[1 ≤ n ≤ 89]）——字符串 #cf_span[s] 的长度。\n\n第二行包含字符串 #cf_span[s] —— 由 _'0'_ 和 _'1'_ 字符组成的序列，表示编码后的数字。保证该字符串对应的数字为正数且不超过 #cf_span[109]。字符串始终以 _'1'_ 开头。\n\n请输出解码后的数字。\n\n## Input\n\n第一行包含一个整数 #cf_span[n]（#cf_span[1 ≤ n ≤ 89]）——字符串 #cf_span[s] 的长度。第二行包含字符串 #cf_span[s] —— 由 _'0'_ 和 _'1'_ 字符组成的序列，表示编码后的数字。保证该字符串对应的数字为正数且不超过 #cf_span[109]。字符串始终以 _'1'_ 开头。\n\n## Output\n\n请输出解码后的数字。\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the length of the binary string.  \nLet $ s = s_1 s_2 \\dots s_n $ be a binary string with $ s_i \\in \\{0,1\\} $, $ s_1 = 1 $.\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 89 $  \n2. $ s_i \\in \\{0,1\\} $ for all $ i \\in \\{1, \\dots, n\\} $  \n3. $ s_1 = 1 $  \n4. The decoded number $ x \\in \\mathbb{Z}^+ $ satisfies $ 1 \\leq x \\leq 10^9 $\n\n**Objective**  \nDecode the binary string $ s $ into a positive integer $ x $ using the following rule:  \nThe string $ s $ is the **binary representation of the number $ x $**, interpreted as a standard binary number.  \nThat is,  \n$$\nx = \\sum_{i=1}^{n} s_i \\cdot 2^{n-i}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF825A","tags":["implementation"],"sample_group":[["3\n111","3"],["9\n110011101","2031"]],"created_at":"2026-03-03 11:00:39"}}