<span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><iostream></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><algorithm></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><cstdio></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><cstring></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><cmath></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><queue></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><cctype></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span> <span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><map></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#include</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><stdio.h></span> <span class="sh-preproc" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 184, 0);">#define</span> INF <span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">0x3f3f3f3f</span> <span class="sh-keyword" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255); font-weight: bold;">typedef</span> <span class="sh-type" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255);">long</span> <span class="sh-type" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255);">long</span> ll<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span> <span class="sh-keyword" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255); font-weight: bold;">using</span> <span class="sh-keyword" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255); font-weight: bold;">namespace</span> std<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span> <span class="sh-type" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255);">char</span> str<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">[</span><span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">300010</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">];</span> <span class="sh-type" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255);">int</span> <span class="sh-function" style="margin: 0px; padding: 0px; line-height: 1.1em; font-weight: bold;">main</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">()</span> <span class="sh-cbracket" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">{</span> <span class="sh-usertype" style="margin: 0px; padding: 0px; line-height: 1.1em;">ll</span><span class="sh-normal" style="margin: 0px; padding: 0px; line-height: 1.1em;"> </span>ans<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span> <span class="sh-type" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255);">int</span> i<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">,</span>len<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span> <span class="sh-keyword" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255); font-weight: bold;">while</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">(</span><span class="sh-function" style="margin: 0px; padding: 0px; line-height: 1.1em; font-weight: bold;">scanf</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">(</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">"%s"</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">,</span>str<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">)!=</span>EOF<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">)</span> <span class="sh-cbracket" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">{</span> len<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">=</span><span class="sh-function" style="margin: 0px; padding: 0px; line-height: 1.1em; font-weight: bold;">strlen</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">(</span>str<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">);</span> ans<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">=</span><span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">0</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span> <span class="sh-keyword" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255); font-weight: bold;">for</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">(</span>i<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">=</span><span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">0</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span>i<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);"><</span>len<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span>i<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">++)</span> <span class="sh-cbracket" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">{</span> <span class="sh-keyword" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255); font-weight: bold;">if</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">((</span>str<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">[</span>i<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">]-</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">'0'</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">)%</span><span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">4</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">==</span><span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">0</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">)</span> ans<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">=</span>ans<span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">+1</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span> <span class="sh-keyword" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255); font-weight: bold;">if</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">(((</span>str<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">[</span>i<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">]-</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">'0'</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">)+(</span>str<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">[</span>i<span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">-1</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">]-</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">'0'</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">)*</span><span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">10</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">)%</span><span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">4</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">==</span><span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">0</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">)</span> ans<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">=</span>ans<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">+</span>i<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span> <span class="sh-cbracket" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">}</span> <span class="sh-function" style="margin: 0px; padding: 0px; line-height: 1.1em; font-weight: bold;">printf</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">(</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">"%I64d</span><span class="sh-specialchar" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(196, 45, 168);">\n</span><span class="sh-string" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">"</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">,</span>ans<span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">);</span> <span class="sh-cbracket" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">}</span> <span class="sh-keyword" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(0, 0, 255); font-weight: bold;">return</span> <span class="sh-number" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(169, 0, 169);">0</span><span class="sh-symbol" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">;</span> <span class="sh-cbracket" style="margin: 0px; padding: 0px; line-height: 1.1em; color: rgb(255, 0, 0);">}</span>