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:

// template : secondThread

import java.io.*;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;



public   class main2 {

        static int solver(String s){
            int n = s.length() ;
            int ope = s.indexOf('[') ;
            int clo = s.lastIndexOf(']') ;
            if (ope <0 || clo <0)
                return -1 ;
            if (ope > clo)
                return -1 ;

            int ct = ope + s.length() - clo - 1;
            s = s.substring(ope+1 , clo) ;
            int col1 = s.indexOf(':');
            int col2 = s.lastIndexOf(':') ;
            if (col1 <0 || col2 <0  )
                return -1 ;
            if(col1 == col2)
                return -1 ;

            ct+= col1 + s.length() - col2 - 1 ;

            for (int i = col1+1; i <col2 ; i++) {
                if (s.charAt(i) != '|')
                    ct++ ;
            }

            return n- ct ;

        }


      public static void main(String[] args) {
          try {


              PrintWriter fop = new PrintWriter(System.out);
              FastScanner fsca = new FastScanner();

              fop.println(solver(fsca.next()));



























              fop.flush();
              fop.close();
          } catch (Exception e) {
              return;
          }


      }
      /*-----------------------------------------------------------------------------------------------------------------------------------------------*/


      static void sieve(int n) {
          boolean[] flag = new boolean[n];

          for (int i = 2; i * i < n; i++) {
              if (flag[i])
                  continue;
              else
                  for (int j = i * i; j <= n; j += i) {
                      flag[j] = true;
                  }
          }
      }


      static int gcd(int a, int b) {
          if (b > a) {
              int tenp = b;
              b = a;
              a = tenp;
          }
          int temp = 0;
          while (b != 0) {
              a %= b;
              temp = b;
              b = a;
              a = temp;
          }
          return a;
      }

      static long gcd_long(long a, long b) {
          if (b > a) {
              long tenp = b;
              b = a;
              a = tenp;
          }
          long temp = 0;
          while (b != 0) {
              a %= b;
              temp = b;
              b = a;
              a = temp;
          }
          return a;
      }


      static final Random random = new Random();

      static void ruffleSort(int[] a) {
          int n = a.length;//shuffle, then sort
          for (int i = 0; i < n; i++) {
              int oi = random.nextInt(n), temp = a[oi];
              a[oi] = a[i];
              a[i] = temp;
          }
          Arrays.sort(a);
      }


      static class FastScanner {
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          StringTokenizer st = new StringTokenizer("");

          String next() {
              while (!st.hasMoreTokens())
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              return st.nextToken();
          }

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

          int[] readArray(int n) {
              int[] a = new int[n];
              for (int i = 0; i < n; i++) a[i] = nextInt();
              return a;
          }

          long[] readLongArray(int n) {
              long[] a = new long[n];
              for (int i = 0; i < n; i++)
                  a[i] = nextLong();
              return a;
          }

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


  }