#include using namespace std; typedef long long ll; ll N; ll M; int twoans[] = {2,4,8,6}; int main() { cin >> N >> M; int two = 0; int five = 0; while(M % 2 == 0) { M /= 2; two++; } while(M % 5 == 0) { M /= 5; five++; } cout << two << ":" << five << endl; if(N % M == 0 || M == 1) { if(two < five) { cout << ((N%10) * twoans[(five - two - 1) % 4]) % 10 << endl; } else { cout << ((N%10) * 5 * (two - five)) % 10 << endl; } } else { cout << -1 << endl; } return 0; }