#pragma TASS input 
int N_BOUND;
#pragma TASS input {N >= 0 && N <= N_BOUND} 
int N;
#pragma TASS input {B > 0} 
int B;
#pragma TASS input 
double a[N];
#pragma TASS output 
double s;

void main() {
	int i=0;
	int j;
	int hi;
	double k=0.0;
	
l:
#pragma TASS jointinvariant @main{i == spec.i && k == spec.j && i <= N && i >= 0}
	while (i < N) {
		j = i;
		if (i + B < N) {
			hi = i + B;
		} else {
			hi = N;
		}
    l:
#pragma TASS jointinvariant @main{j == spec.i && k == spec.j && j <= hi && j >= 0}
		while (j < hi) {
			k = k + a[j];
			j = j + 1;
		}   
		i = hi;
	}
	s = k;
}


