#include <iostream>
#include <iomanip>
using namespace std;
int main() {
long long B, M;
cin >>B,M;
long long int sum=(M%5) ;
long long int sum1=(B%5) ;
cout << sum+sum1 ;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG1haW4oKSB7CmxvbmcgbG9uZyAgQiwgTTsKCmNpbiA+PkIsTTsKbG9uZyBsb25nIGludCBzdW09KE0lNSkgOwpsb25nIGxvbmcgaW50IHN1bTE9KEIlNSkgOwpjb3V0IDw8IHN1bStzdW0xIDsKICAKCiByZXR1cm4gMDsKCn0KCg==