Description
Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bob can «buy» any TV sets he wants. Though he's very strong, Bob can carry at most m TV sets, and he has no desire to go to the sale for the second time. Please, help Bob find out the maximum sum of money that he can earn.
Input
The first line contains two space-separated integers n and m (1 ≤ m ≤ n ≤ 100) — amount of TV sets at the sale, and amount of TV sets that Bob can carry. The following line contains n space-separated integers ai ( - 1000 ≤ ai ≤ 1000) — prices of the TV sets.
Output
Output the only number — the maximum sum of money that Bob can earn, given that he can carry at most m TV sets.
Sample Input
5 3
-6 0 35 -2 4
8
4 2
7 0 0 -7
7
1 #include <stdio.h> 2 #include <string.h> 3 int main() 4 { 5 int n; 6 int i,j,k; 7 while(scanf("%d",&n)!=EOF) 8 { 9 if(n%2==0) 10 { 11 printf("%d ",n*n/2); 12 for(i=1;i<=n/2;i++) 13 { 14 for(j=1;j<=n;j++) 15 if(j%2==1) 16 printf("C"); 17 else 18 printf("."); 19 printf(" "); 20 for(j=1;j<=n;j++) 21 if(j%2==0) 22 printf("C"); 23 else 24 printf("."); 25 printf(" "); 26 } 27 } 28 else 29 { 30 printf("%d ",(n+1)*(n+1)/4+(n-1)*(n-1)/4); 31 for(i=1;i<=n;i++) 32 { 33 if(i%2==1) 34 { 35 for(j=1;j<=n;j++) 36 if(j%2==1) 37 printf("C"); 38 else 39 printf("."); 40 printf(" "); 41 } 42 else 43 { 44 for(j=1;j<=n;j++) 45 if(j%2==0) 46 printf("C"); 47 else 48 printf("."); 49 printf(" "); 50 } 51 } 52 } 53 } 54 return 0; 55 }