// Sigue el primer nivel de Karatsuba con 1234 x 5678.
#include <iostream>

#include "karatsuba.h"

int main() {
    long long products = 0;
    Digits x = from_string("1234");
    Digits y = from_string("5678");
    Digits a = from_string("12");
    Digits b = from_string("34");
    Digits c = from_string("56");
    Digits d = from_string("78");
    Digits ac = karatsuba(a, c, 3, products);
    Digits bd = karatsuba(b, d, 3, products);
    Digits sum_ab = add(a, b);
    Digits sum_cd = add(c, d);
    Digits sums = karatsuba(sum_ab, sum_cd, 3, products);
    Digits middle = subtract(subtract(sums, ac), bd);
    std::cout << "a = 12, b = 34, c = 56, d = 78, m = 2\n";
    std::cout << "ac = " << to_string(ac) << "\n";
    std::cout << "bd = " << to_string(bd) << "\n";
    std::cout << "(a + b)(c + d) = " << to_string(sum_ab) << " x " << to_string(sum_cd) << " = " << to_string(sums) << "\n";
    std::cout << "ad + bc = " << to_string(sums) << " - " << to_string(ac) << " - " << to_string(bd) << " = " << to_string(middle) << "\n";
    long long other = 0;
    std::cout << "resultado = " << to_string(karatsuba(x, y, 3, other)) << "\n";
    std::cout << "la escuela da = " << to_string(school_multiply(x, y, other)) << "\n";
}
