#include<iostream>
using namespace std;

int main()
{
	int a,b,c,d=1000000;
	cin>>a>>b;
	
	for(int i=1;i<=200;i++){
		a+=b;
		short answer=7;
		while(1){
			if(a/d==0){
				answer--;
			        d/=10;
			}
			else{
				cout<<answer<<endl;
				break;
			}
		}
		d=1000000;
		answer=7;
		cin>>a>>b;
	}
	return 0;
}