
    Design a function that calculates the cumulative security score for a mobile banking transaction by summing the first n numbers in the bank's proprietary verification sequence, where each number is determined by the sum of the values three and two positions before it, minus the value one position before it. The resulting sum helps determine the level of biometric authentication required for the transaction, with higher sums requiring additional verification steps.
    

    
def cal_sum(n):
    """
    Design a function that calculates the cumulative security score for a mobile banking transaction by summing the first n numbers in the bank's proprietary verification sequence, where each number is determined by the sum of the values three and two positions before it, minus the value one position before it. The resulting sum helps determine the level of biometric authentication required for the transaction, with higher sums requiring additional verification steps.
    

    """
def cal_sum(n):
    """
    Design a function that calculates the cumulative security score for a mobile banking transaction by summing the first n numbers in the bank's proprietary verification sequence, where each number is determined by the sum of the values three and two positions before it, minus the value one position before it. The resulting sum helps determine the level of biometric authentication required for the transaction, with higher sums requiring additional verification steps.
    

    """
    a = 3
    b = 0
    c = 2
    if n == 0:
        return 3
    if n == 1:
        return 3
    if n == 2:
        return 5
    sum = 5
    while n > 2:
        d = a + b
        sum = sum + d
        a = b
        b = c
        c = d
        n = n - 1
    return sum