#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,t1,t2,t3;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t1=0;
t2=0;
t3=0;
for (i=1; i<=n; i++)
{
t1+=a[i];
if (a[i]<0) t2+=a[i];
if (a[i]>0) t3+=a[i];
}
cout<<t1<<endl;
cout<<t2<<endl;
cout<<t3;
return 0;
}