Problem: An accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented as a concatenation of: an opening bracket (ASCII code 091), a colon (ASCII code 058), some (possibly zero) vertical line characters (ASCII code 124), another colon, and a closing bracket (ASCII code 093). The length of the accordion is the number of characters in it.

For example, [::], [:||:] and [:|||:] are accordions having length 4, 6 and 7. (:|:), {:||:}, [:], ]:||:[ are not accordions. 

You are given a string s. You want to transform it into an accordion by removing some (possibly zero) characters from it. Note that you may not insert new characters or reorder existing ones. Is it possible to obtain an accordion by removing characters from s, and if so, what is the maximum possible length of the result?

Input

The only line contains one string s (1 ≤ |s| ≤ 500000). It consists of lowercase Latin letters and characters [, ], : and |.

Output

If it is not possible to obtain an accordion by removing some characters from s, print -1. Otherwise print maximum possible length of the resulting accordion.

Examples

Input


|[a:b:|]


Output


4


Input


|]:[|:]


Output


-1

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;
//import javafx.util.Pair;
public class Solution implements Runnable 
{  
    
    class Pair implements Comparable <Pair>
    {
        long x,y;
        Pair(long x,long y)
        {
            this.x=x;
            this.y=y; 
        }
        public int compareTo(Pair p)
        {
            return Long.compare(x,p.x);
        }
    }
    
    public static void main(String[] args)
    {
        new Thread(null, new Solution(), "rev", 1 << 29).start();
    }

    public void run()
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1,in,out);
        out.close();
    }
    
    class Task
    { 
        
        void solve(int testNumber, InputReader in, PrintWriter out)
        { 
            String s=in.nextString();
            int n=s.length(),i=0,j=n-1,ct=0;
            boolean f=false;
            while(i<n && s.charAt(i)!='[')
                i++;                
            while(j>i && s.charAt(j)!=']')
                j--;
            int i1=i+1,j1=j-1;
            while(i1<j && s.charAt(i1)!=':')
                i1++;
            while(j1>i1 && s.charAt(j1)!=':')
                j1--;
            for(int k=i1+1;k<j1;k++)
                if(s.charAt(k)=='|')
                        ct++;
            if(i1<j1)
                f=true;
            if(!f)
                out.print("-1");
            else
                out.print(ct+4);
        }
    }
    
}

class InputReader 
{
    private InputStream stream;
    private byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;
 
    public InputReader(InputStream stream) 
    {
        this.stream = stream;
    }
 
    public int snext() 
    {
        if(snumChars==-1)
            throw new InputMismatchException();
        if(curChar>=snumChars)
        {
            curChar=0;
            try 
            {
                snumChars = stream.read(buf);                
            } 
            catch(IOException e) 
            {
                throw new InputMismatchException();
            }
            if(snumChars<=0)
                return -1;
        }
        return buf[curChar++];
    }
 
    public int nextInt()
    {
        int c = snext();
        while(isSpaceChar(c))
            c=snext();
        int sgn=1;
        if(c=='-')
        {
            sgn = -1;
            c = snext();
        }
        int res=0;
        do
        {
            if(c<'0' || c>'9')
                throw new InputMismatchException();
            res*=10;
            res+=c-'0';
            c=snext();
            }while(!isSpaceChar(c));
        return res * sgn;
    }
 
    public long nextLong()
    {
        int c = snext();
        while(isSpaceChar(c))
            c=snext();
        int sgn=1;
        if(c=='-')
        {
            sgn=-1;
            c=snext();
        }
        long res=0;
        do{
            if (c<'0' || c>'9')
                throw new InputMismatchException();
            res*=10;
            res+=c-'0';
            c=snext();
        }while (!isSpaceChar(c));
        return res * sgn;
    }
 
    public int[] nextIntArray(int n)
    {
        int a[]=new int[n];
        for(int i=0; i<n; i++)
            a[i]=nextInt();
        return a;
    }

    public long[] nextLongArray(int n)
    {
        long a[]=new long[n];
        for(int i=1; i<n; i++)
            a[i]=nextLong();
        return a;
    }
    public String nextString()
    {
        int c=snext();
        while(isSpaceChar(c))
            c=snext();
        StringBuilder res=new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = snext();
        }while (!isSpaceChar(c));
        return res.toString();
    }
 
    public boolean isSpaceChar(int c)
    {
        if(filter != null)
            return filter.isSpaceChar(c);
        return c==' ' || c=='\n' || c=='\r' || c=='\t' || c==-1;
    }
 
    public interface SpaceCharFilter
    {
        public boolean isSpaceChar(int ch);
    }
}