#include<iostream>
#include<cstdio>
#include<cstring>
#include<set>
#include<vector>
#include<fstream>
using namespace std;
int a[10];
int main()
{
ifstream inFile("C:\\Users\\DELL\\Desktop\\in.txt", ios::in);
a[1] = 1;
a[2] = 2;
a[3] = 3;
a[4] = 5;
a[5] = 10;
a[6] = 20;
set<int> b;
b.insert(0);
for (int i = 1; i <= 6; ++i){
int k;
inFile >> k;
for (int j = 0; j < k; ++j){
vector<int> c;
for (set<int>::iterator it = b.begin(); it != b.end(); ++it){
c.push_back(*it + a[i]);
}
b.insert(c.begin(), c.end());
c.clear();
}
}
for (auto it = b.begin(); it != b.end(); ++it){
if (*it>0)
cout << *it << endl;
}
cout << b.size()-1 << endl;
system("pause");
return 0;
}