#include "iostream"
#include "numeric"
#include "ctime"
#include "cstdlib"
using namespace std;
int f(int *a,int n){return accumulate(a,a+n,0,[](int x,int y){return x+y*(y>0);});};
int main(){
const int n=8; int a[n]; srand(time(NULL));
for(int &i:a)cout<<(i=rand()%10-5)<<' '; cout<<endl;
cout<< f(a,n)<< endl;}