function [ui] = fehrSchmidt1999(x, i, alphai, betai )
% Jonathan Frei
% x is a vector of the payoff for each individual, i is the index of the
% individual, alphai is the penalty for having a lower payoff and betai
% the penalty for having more
n=numel(x);
ui=x(i)-(alphai/(n-1))*sum(max(x(x~=i)-x(i),0))-(betai/(n-1))*sum(max(x(i)-x(x~=i),0));
end