Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $a$ coins, Barbara has $b$ coins and Cerene has $c$ coins. Recently Polycarp has returned from the trip around the world and brought $n$ coins.

He wants to distribute all these $n$ coins between his sisters in such a way that the number of coins Alice has is equal to the number of coins Barbara has and is equal to the number of coins Cerene has. In other words, if Polycarp gives $A$ coins to Alice, $B$ coins to Barbara and $C$ coins to Cerene ($A+B+C=n$), then $a + A = b + B = c + C$.

Note that A, B or C (the number of coins Polycarp gives to Alice, Barbara and Cerene correspondingly) can be 0.

Your task is to find out if it is possible to distribute all $n$ coins between sisters in a way described above.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The next $t$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $a, b, c$ and $n$ ($1 \le a, b, c, n \le 10^8$) — the number of coins Alice has, the number of coins Barbara has, the number of coins Cerene has and the number of coins Polycarp has.


-----Output-----

For each test case, print "YES" if Polycarp can distribute all $n$ coins between his sisters and "NO" otherwise.


-----Example-----
Input
5
5 3 2 8
100 101 102 105
3 2 1 100000000
10 20 15 14
101 101 101 3

Output
YES
YES
NO
NO
YES

Difficulty: introductory

Starter code:

Solutions:
a = int(input())
for i in range(a):
    a1, b, c, n = list(map(int, input().split()))
    t = max(a1, b, c)
    if ((a1 + b + c + n) % 3 == 0 and t <= (a1 + b + c + n)//3 ):
        print('YES')
    else:
        print('NO')


t = int(input())
for _ in range(t):
	a, b, c, n = map(int, input().split())

	m = max(a, b, c)

	su = m-a + m-b + m-c

	if n < su:
		print("NO")
		continue

	n -= su
	if n%3 == 0:
		print("YES")
	else:
		print("NO")

import sys
input = sys.stdin.readline

for _ in range(int(input())):
	a, b, c, n = map(int, input().split())
	a, b, c = sorted([a, b, c])
	n -= (c-a)
	n -= (c-b)
	if n >= 0 and n%3 == 0:
		print('YES')
	else:
		print('NO')

t=int(input())
for _ in range(t):
    a,b,c,n=list(map(int,input().split()))
    a,b,c=sorted([a,b,c])
    x=2*c-b-a
   # print(x)
    if n<x:
        print("NO")
    elif (x-n)%3==0:
        print("YES")
    else:
        print("NO")


#!/usr/bin/env python3
# coding: utf-8
# Last Modified: 22/Jan/20 08:07:33 PM


import sys


def main():
    for tc in range(int(input())):
        a, b, c, n = get_ints()
        x = a + b + c + n
        if x % 3 != 0:
            print("NO")
        else:
            y = max(a, b, c)
            if (x // 3) >= y:
                print("YES")
            else:
                print("NO")


get_array = lambda: list(map(int, sys.stdin.readline().split()))


get_ints = lambda: list(map(int, sys.stdin.readline().split()))


input = lambda: sys.stdin.readline().strip()


def __starting_point():
    main()

__starting_point()

#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=int(input())
for tt in range(t):
    #n=int(input())
    a,b,c,n= map(int, sys.stdin.readline().split(' '))
    give = (a+b+c+n)//3
    x=give-a
    y=give-b
    z=give-c

    if (give*3==a+b+c+n) and (x>=0) and (y>=0) and (z>=0) and (x+y+z==n):
        print("YES")
    else:
        print("NO")
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

for _ in range(int(input())):
    a,b,c,n = [int(s) for s in input().split()]
    a,b,c = sorted([a,b,c])
    w = c-a+c-b
    if w>n:
        print("NO")
    else:
        if (n-w)%3==0:
            print("YES")
        else:
            print("NO")

t=int(input())
while(t):
    t-=1
    a,b,c,n=list(map(int,input().split()))
    d=max(a,b,c)
    f=(d-a)+(d-b)+(d-c)
    if(f>n):
        print("NO")
        continue
    n-=f
    if(n%3==0):
        print("YES")
    else:
        print("NO")


t = int(input())
for _ in range (t):
    a, b, c, n = list(map(int, input().split()))
    d = 3 * max(a, b, c) - a - b- c
    e = n - d
    if e >= 0 and e % 3 == 0:
        print("YES")
    else:
        print("NO")

#-------------Program--------------
#----Kuzlyaev-Nikita-Codeforces----
#-------------Round615-------------
#----------------------------------

t=int(input())
for i in range(t):
    a,b,c,n=map(int,input().split())
    a=[a,b,c];a.sort()
    k=a[2]-a[1]+a[2]-a[0]
    if n<k:
        print('NO')
    else:
        if (n-k)%3!=0:
            print('NO')
        else:
            print('YES')

for _ in range(int(input())):
    a,b,c,n=map(int,input().split())
    s=a+b+c
    mx=max(a,b,c)
    if((s+n)%3==0 and (s+n)//3 >= mx):
        print("YES")
    else:
        print("NO")

import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1/0
def write(*args, sep="\n"):
  for i in args:
    sys.stdout.write("{}{}".format(i, sep))
INF = float('inf')
MOD = int(1e9 + 7)
YES = "YES"
NO = "NO"

for _ in range(int(input())):
  try:
    a, b, c, n = read()
    x = max([a, b, c])
    n -= x - a 
    n -= x - b 
    n -= x - c 

    if n < 0:
      print(NO)
      go()
    
    if n % 3 == 0:
      print(YES)
    else:
      print(NO)

  except:
    continue

import sys

# inf = open('input.txt', 'r')
# reader = (line.rstrip() for line in inf)
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__

t = int(input())
for _ in range(t):
    a, b, c, n = list(map(int, input().split()))
    if (a + b + c + n) % 3 == 0:
        each = (a + b + c + n) // 3
        if a <= each and b <= each and c <= each:
            print('YES')
        else:
            print('NO')
    else:
        print('NO')

# inf.close()



T=int(input())
for _ in range(T):
    a,b,c,n=list(map(int,input().split()))
    mx=max(a,b,c)
    tot=mx-a+mx-b+mx-c

    if(n<tot):
        print('NO')
    else:
        n=n-tot
        if(n%3==0):
            print('YES')
        else:
            print('NO')
    


import sys
input = sys.stdin.readline

t=int(input())

for test in range(t):
    a,b,c,n=list(map(int,input().split()))

    M=max(a,b,c)
    n-=(M-a)+(M-b)+(M-c)

    if n<0:
        print("NO")
    else:
        if n%3==0:
            print("YES")
        else:
            print("NO")


t = int(input())
ans = list()
for i in range(t):
    (a, b, c, n) = map(int, input().split())
    d = [a, b, c]
    d.sort()
    if d[2] - d[0] + d[2] - d[1] > n:
        ans.append('NO')
    else:
        n -= d[2] - d[0]
        n -= d[2] - d[1]
        if n %3 != 0:
            ans.append('NO')
        else:
            ans.append('YES')
print(*ans,sep='\n')


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline
 
# M = mod = 998244353
# def factors(n):return sorted(list(set(reduce(list.__add__,([i, n//i] forn() i in range(1, int(n**0.5) + 1) if n % i == 0)))))
# def inv_mod(n):return pow(n, mod - 2, mod)
 
def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n').split(' ')]
def li3():return [int(i) for i in input().rstrip('\n')]


for _ in range(val()):
    a,b,c,n = li()
    a,b,c = sorted([a,b,c])
    if c - a>n:
        print('NO')
        continue
    else:
        n -= (c-a)
        a = c
    if c -b > n:
        print('NO')
        continue
    else:
        n -= (c-b)
        b = c
    if n%3:
        print('NO')
        continue
    print('YES')

for _ in range(int(input())):
    a, b, c, n = list(map(int, input().split()))
    a, b, c = sorted([a, b, c])
    delta = (c - a) + (c - b)
    if n >= delta and (n - delta) % 3 == 0:
        print("YES")
    else:
        print("NO")



t = int(input())

for loop in range(t):

    a,b,c,n = list(map(int,input().split()))

    n -= max(a,b,c) - a
    n -= max(a,b,c) - b
    n -= max(a,b,c) - c

    if n >= 0 and n % 3 == 0:
        print ("YES")
    else:
        print ("NO")


n = int(input())
for i in range(n):
    a, b, c, d = list(map(int, input().split()))
    need = max(a, b, c)
    d -= (need - a)
    d -= (need - b)
    d -= (need - c)
    if d >= 0 and d % 3 == 0:
        print('YES')
    else:
        print('NO')


for _ in range(int(input())):
    a, b, c, n = list(map(int, input().split()))
    s = (a+b+c+n)
    if s % 3 == 0 and s // 3 >= a and s // 3 >= b and s // 3 >= c:
        print('YES')
    else:
        print('NO')


for _ in range(int(input())):
    a, b, c, n = map(int, input().split())
    mm = max(a, b, c)
    n -= (mm-a)
    n -= mm-b
    n-= mm - c
    if n >= 0 and n % 3 == 0:
        print("YES")
    else:
        print("NO")