function [R Gr He] = profit(wiegths,r1,r2)

w1 = wiegths(1);
w2 = wiegths(2);
R = w1*r1 + w2*r2;
Gr(1) = r1;
Gr(2) = r2;
He = eye(2);
