// PascalABC.NET 3.6
begin
var n := 20;
var a := ArrRandom(n, 2, 5);
a.Println;
var b := ArrRandom(n, 2, 5);
b.Println;
var c := ArrRandom(n, 2, 5);
c.Println;
var s := 0;
for var i := 0 to n - 1 do
if (a[i] = b[i]) and (b[i] = c[i]) then
s += 3 * a[i];
Print(s)
end.