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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.util.*;


public class Soly
{
    static final int INF = Integer.MAX_VALUE;

    static void mergeSort(int[] a,int [] c, int b, int e)
    {
        if(b < e)
        {
            int q = (b + e) >>1;
            mergeSort(a,c, b, q);
            mergeSort(a, c,q + 1, e);
            merge(a,c, b, q, e);
        }
    }


    static void merge(int[] a,int[]c, int b, int mid, int e)
    {
        int n1 = mid - b + 1;
        int n2 = e - mid;
        int[] L = new int[n1+1], R = new int[n2+1];
        int[] L1 = new int[n1+1], R1 = new int[n2+1];

        for(int i = 0; i < n1; i++) {
            L[i] = a[b + i];
            L1[i] = c[b + i];
        }
        for(int i = 0; i < n2; i++)  {
            R[i] = a[mid + 1 + i];
            R1[i] = c[mid + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for(int k = b, i = 0, j = 0; k <= e; k++)
            if(L[i] <= R[j]){
                a[k] = L[i];
                c[k] = L1[i++];
            }

            else
            {
                a[k] = R[j];
                c[k] = R1[j++];
            }
    }
    static int s;
            static Stack<Character> sta;
static int type(char[] a){
        sta= new Stack<>();
        s=0;
        int op=0,cl=0;
    for (int i = 0; i < a.length; i++) {
        if (a[i]==')'){
            if (!sta.isEmpty()&&sta.peek()=='('){
                op--;
                sta.pop();
            }
            else{
                cl++;
                sta.push(')');
            }
        }
        else{
            op++;
           sta.push('(');
        }
    }
    if (sta.isEmpty())return 0;
    else{
        s=sta.size();
        //1 --> closing
        //2 -->opening
        if (op>0&&cl>0)return 50;
        else{
            if (op>0)return 2;
            return 1;
        }

    }
}



    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        try (PrintWriter or = new PrintWriter(System.out)) {
            char[] a=in.next().toCharArray();
            int st=-1,end=-1;
            for (int i = 0; i < a.length; i++) {
                if (a[i]=='['){
                    st=i;
                    break;
                }
            }
            if (st==-1){
                or.println(-1);return;
            }
            for (int i = a.length-1; i>st; i--) {
                if (a[i]==']'){
                    end=i;
                    break;
                }
            }
            if (end==-1||(Math.abs(st-end)<3)){
                or.println(-1);
                return;
            }
            int ma=Math.abs(st-end);
            int colon=-1,cc=0;
            for (int i = st; i <=end ; i++) {
                if (a[i]==':'){
                    if (colon==-1)colon=i;
                    cc++;
                }
            }
            if (cc<2){
                or.println(-1);return;
            }
            int c2=-1;
            for (int i = end; i >=st ; i--) {
                if (a[i]==':'){
                    c2=i;break;
                }
            }
            int line=0;
            for (int i = colon; i <=c2 ; i++) {
                if (a[i]=='|')++line;
            }
            or.println(line+4);





        }
        }











    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }



}
class coooo {
    int x,y;

    public coooo(int x, int y) {
        this.x = x;
        this.y = y;
    }
}