#include using namespace std; int n, x, y, z; int main() { scanf("%d", &n); x = y = 0; z = 1; while (n > 0) { if (n % 10 == 7) { x += 8 * z; y += z; } else { x += (n % 10) * z; } n /= 10; z *= 10; } printf("%d %d\n", x, -y); return 0; }