S,K = map(int,input().split()) print(S%1000 + K)