#include<bits/stdc++.h>
using namespace std;
int a[200000],b[200000];
int main(){
    int i,m,n,j,s=0;
    cin>>m>>n;
    for(i=0;i<=m;i++){
        for(j=0;j<=n;j++){
            if(j==0&&i==0){
            }
            else{
                b[s]=i*3+j*5;
                s++;
            }
        }
    }
    sort(b,b+s);
    for(i=0;i<s;i++){
        cout<<b[i]<<" ";
    }
    cout<<endl<<s;
    return 0;
}
/**************************************************************
	Problem: 1252
	User: lijinkai
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:3640 kb
****************************************************************/