/*
* * author: attacker
* * created: 31.03.2026 13:43:42
*/
#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);
int64_t a, b;
cin >> a >> b;
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;
};
if (Is_prime(abs(a - b))) {
cout << 2 << '\n' << a << ' ' << b << '\n';
} else {
bool found = false;
for (int64_t val = 1; val <= 1000; val++) {
if (Is_prime(abs(val - a)) && Is_prime(abs(val - b)) && Is_prime(val)) {
cout << 3 << '\n' << a << ' ' << val << ' ' << b << '\n';
found = true;
break;
}
}
if (!found) {
cout << -1 << '\n';
}
}
return 0;
}