#include "iostream" using namespace std; char num[10004]; int sum=0; long long int ans[1000] = {}; bool flag=true; int far = 0; int main() { cin >> num; ans[0] = 1; for (int i = 0;; i++) { if (num[i] == NULL) { cout << num<<"\n"; return 0; } if (num[i] != num[0])break; } for (int i = 0;; i++) { if (num[i] == NULL) { ans[0] = 8; flag = false; } if ((int)(num[i] - '0') % 8 != 0)break; } if (flag) { for (int i = 0;; i++) { if (num[i] == NULL) { ans[0] = 4; flag = false; } if ((int)(num[i] - '0') % 4 != 0)break; } } if (flag) { for (int i = 0;; i++) { if (num[i] == NULL) { ans[0] = 2; flag = false; } if ((int)(num[i] - '0') % 2 != 0)break; } } for (int i = 0;; i++) { if (num[i] == NULL) { ans[0] *= 5; flag = false; } if ((int)(num[i] - '0') % 5 != 0)break; } for (int i = 0;; i++) { if (num[i] == NULL) { ans[0] *= 7; flag = false; } if ((int)(num[i] - '0') % 7 != 0)break; } for (int i = 0;; i++) { if (num[i] == NULL)break; sum += num[i] - '0'; } while (sum % 3 == 0) { sum /= 3; for (int i = far; i >= 0; i--) { ans[i] *= 3; if (ans[i] >= 100000000000) { ans[i + 1] += ans[i] / 100000000000; ans[i] %= 100000000000; far++; } } } for (int i = far; i >= 0; i--) { cout << ans[i]; } cout << "\n"; return 0; }