This is a classic case for the use of associative arrays (language-agnostic example):
Code:
person{$1} = person{$1} + $2;
Until the first encounter with each 'person' (the key field), the array element does not exist. Thereafter, it exists, has a numeric value, and can be arithmetically manipulated. This kind of code can be used in Awk, Perl, PHP (I think), Python (I think), maybe some others.
--- rod.