#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct B{
    double array[5];
    struct B* next;
}A;
int main(void)
{
    A* current =NULL;
    A* top=NULL;
    A* before=NULL;
    char answer='y';
    double sum=0.0;
    int i=0;
    
    for(;;){
        current=(A*)malloc(sizeof(A));
        for( i=0;i<5;i++){
            printf("please input a double:");
            scanf("%lf",&(current->array[i]));
            printf("do you want to input again:");
            scanf("%c",&answer);
            if(tolower(answer)=='n')
                break;
        }
        if(top==NULL){
            top=current;
            before=current;
            before->next=NULL;
        }else
        {   before->next=current;
            current->next=NULL;
        }
        if(tolower(answer)=='n')
            break;
        
    }
    current=top;
    while(current!=NULL){
        while(current->array[ i++]!='\0')
            sum+=current->array[i];
        current=current->next;
    }
    printf("%lf",sum);
    return 0;
}