/*
* * author: attacker
* * created: 31.03.2026 15:51:53
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 1
#endif
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define bpc __builtin_popcount
#define size(v) (int)(v.size())
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
auto Is_prime = [&](int64_t x) {
if (x == 2) return true;
if (x % 2 == 0) return false;
if ((int64_t)(sqrt(x)) * (int64_t)(sqrt(x)) == x) return false;
for (int64_t i = 3; i * i <= x; i += 2) {
if (x % i == 0) {
return false;
}
}
return true;
};
int64_t a, b;
cin >> a >> b;
vector<int64_t> res;
res.push_back(a);
if (a != 2) {
if (Is_prime(a - 2)) {
res.push_back(2);
} else if (Is_prime(a + 2)) {
res.push_back(a + 2);
res.push_back(2);
} else {
cout << -1 << '\n';
return 0;
}
}
if (Is_prime(b - 2)) {
res.push_back(b);
} else if (Is_prime(b + 2)) {
res.push_back(b + 2);
res.push_back(b);
} else {
cout << -1 << '\n';
return 0;
}
cout << size(res) << '\n';
for (int i = 0; i < size(res); i++) {
cout << res[i] << " \n"[i == size(res) - 1];
}
return 0;
}