public class Assignment8 {
public static void main(String args[])
{
//checking testcases
// int[] arr= {1,2,3,4,6,8,9,7,2};
// int[] arr= {1,2,3,6,4,2,8,7,4};
// int[] arr= {7,1,2,3,6};
int[] arr= {1,2,3};
int sixPos=-1;
int sevenPos=-1;
int sum=0;
for(int i=0;i<arr.length;i++)
{
if(arr[i]==6) sixPos=i;
if(arr[i]==7) sevenPos=i;
}
if(sevenPos==-1) sixPos=-1;
for(int i=0;i<arr.length;i++)
{
if(sixPos!=-1 && i>=sixPos && i<=sevenPos) continue;
sum+=arr[i];
}
System.out.println(sum);
}
}