#include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b;
	int c1=1,c2=1;
	while(cin>>a>>b){
		while(1){
			if(a%10==0)
				++c1;
			else
				break;
		}
		while(1){
			if(b%10==0)
				++c2;
			else
				break;
		}
	}
		cout<<c1+c2<<endl;
    return 0;
}