
#include <iostream>
#include <cstdlib>

int main(int argc, char *argv[])
{
	int a, b;
	std::cin >> a >> b;

	int q=0, r;

	r= a;
	int d= 1;
	int o= d*b;
	int t;
	do {
		t= o;
		o*= 10;
	} while (o<=a);	
	
	std::cout << "t: " << t << std::endl;

	while ( b <= t) {
		q= 10*q;	
		while (t <= r) {
			r-=t;
			++q;
		}
		std::cerr << "... sali de restar\n";
		std::cout << "r: " << r << std::endl;
		t/= 10;
		std::cout << "t: " << t << std::endl;
	}

	std::cout << "q: " << q << std::endl;
	std::cout << "r: " << r << std::endl;
	std::cout << "q*b+r: " << q*b+r << std::endl;
	return EXIT_SUCCESS;
}
