# Include <iostream> # include <vector> # include <algorithm> # include <fstream> # include <bitset> using namespace STD; int main () {int N; while (CIN> N & n> 0) {vector <string> data (n); string sum ("0"); For (INT I = 0; I <n; I ++) {CIN> data [I]; reverse (data [I]. begin (), data [I]. end (); // string reverse int flag = 0; Int J = 0; For (j = 0; j <data [I]. size () & J <sum. size (); j ++) {int result = 0; Result = Flag + (data [I] [J]-'0 ') + (sum [J]-'0'); If (result> = 10) {flag = 1; Result = Result-10;} else flag = 0; sum [J] = Result + '0';} // end for Jif (j> = sum. size () {sum = sum + data [I]. substr (J, data [I]. size ()-j);} If (flag = 1) {While (1) {If (j> = sum. size () {sum = sum + "1"; break;} else {sum [J] ++; If (sum [J]> '9 ') {sum [J] = '0'; j ++;} else break ;}}} reverse (sum. begin (), Sum. end (); cout <sum <Endl ;}}