Help me in solving TANDJ1 problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    int a,b,c,d,k;
	    cin>>a>>b>>c>>d>>k;
	    int sum;
	    sum=a+b+c+d;
	    if(sum%k==0){
	        cout<<"YES"<<endl;
	    }else{
	        cout<<"NO\n";
	    }
	}
	return 0;
}

Problem Link: CodeChef: Practical coding for everyone

@manojs10
I think your logic is not correct u think of the manhattan distance between jerry and tom and also draw the condition in rough to understand it better .