arr = map(int, input().split()) print(sum(v*v for v in arr)%10)