#include <stdio.h>
int p(int a,int x[],int b,int y[],int n)
{
int i,s=0;
for(i=0;i<n;i++)
{
s+=a*x[i]+b*y[i];
}
return s;
}
int d[]= {2,3,5,4,9,10,8};
int v[]= {7,6,3,2,5,1,8,9,3,4};
int w[]= {1,2,3,4,5,6,7,8,9,10};
int main()
{
printf("s1=%d\n",p(1,d,2,v,7));
printf("s2=%d\n",p(3,v,4,w,9));
}