#include extern int getchar_unlocked(void); extern int putchar_unlocked(int); #define ull unsigned long long #define gc(d) (d)=getchar_unlocked() #define pc(d) putchar_unlocked(d) static char *GETWORD(char* r) {char c;char *cp;cp=&r[0];gc(c);while(c!=EOF){if((c==' ')||(c=='\n'))break;*cp++=c;gc(c);}*cp='\0';return &r[0];} void outl(ull n) { int i; char b[70]; if (!n) pc('0'); else { if (n < 0) pc('-'), n = -n; i = 0; while (n) b[i++] = n % 10 + '0', n /= 10; while (i--) pc(b[i]); } pc('\n'); } ull a2l(char *r) { ull res; ull sign; int i; res = 0; sign = 1; i = 0; while ((r[i]==' ')||(r[i]=='\t')||(r[i]=='\n')||(r[i]=='\v')||(r[i]=='\r')||(r[i]=='\f')) i++; /* if (r[i] == '-') sign = -1; if (r[i] == '+' || r[i] == '-') i++; */ while ((r[i]>='0')&&(r[i]<='9')){ ull dmy = res; res <<= 3; dmy <<= 1; res = res + dmy; res += (ull)(r[i] - '0'); i++; } return res * sign; } // ********************* int main( void ) { int q; ull sum = 0L; char s[65]; GETWORD(s); q=(int)a2l(s); for(int i=0;i