#include <iostream>
#include <string>
#include <cmath>
using namespace std;
// Function to calculate the Karatsuba multiplication of two numbers
long long karatsuba(long long x, long long y){
// Base case for recursion
if(x < 10 || y < 10){
return x*y;
}
// Determine the size of the numbers
int n = max(to_string(x).length(), to_string(y).length());
// Split the digits in half
int n2 = n / 2;
long long a = x / pow(10, n2);
long long b = x % pow(10, n2);
long long c = y / pow(10, n2);
long long d = y % pow(10, n2);
// Recursively calculate the 3 products
long long ac = karatsuba(a, c);
long long bd = karatsuba(b, d);
long long ad_plus_bc = karatsuba(a+b, c+d) - ac - bd;
// Combine the results
return ac * pow(10, 2*n2) + (ad_plus_bc * pow(10, n2)) + bd;
}
int main(int argc, char* argv[]) {
// Get the two numbers from command line arguments
long long x = stoll(argv[1]);
long long y = stoll(argv[2]);
// Calculate and print result
long long result = karatsuba(x, y);
cout << "Result: " << result << endl;
return 0;
}