int main() { int i=0,b=0; while(1) { i=i+1; int a[i]; scanf("%d",&a[i]); if(a[i]!=-1) { b=b+a[i]; } else { break; } } printf("%d",b); return 0; }