You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Then, an undirected graph is constructed in the following way: add an edge between vertices $$$i$$$, $$$j$$$ such that $$$i < j$$$ if and only if $$$p_i > p_j$$$. Your task is to count the number of connected components in this graph.Two vertices $$$u$$$ and $$$v$$$ belong to the same connected component if and only if there is at least one path along edges connecting $$$u$$$ and $$$v$$$.A permutation is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is $$$4$$$ in the array).

Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of the permutation. The second line of each test case contains $$$n$$$ integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le n$$$) — the elements of the permutation. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

For each test case, print one integer $$$k$$$ — the number of connected components.

NoteEach separate test case is depicted in the image below. The colored squares represent the elements of the permutation. For one permutation, each color represents some connected component. The number of distinct colors is the answer.

"use strict";

//let startTime = Date.now();

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});

process.stdin.on("end", (_) => {
    inputString = inputString
        .trim()
        .split("\n")
        .map((string) => {
            return string.trim();
        });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
    const numOfTests = +(readline());
    let resultString = "";

    for (let i=0; i<numOfTests; i++){
        const lengthOfArr = +(readline());
        const arr = readline().split(" ").map((string) => {
            return +(string);
        });

        let result = [];

        let h = arr[0];
        let l = arr[0];
        let index = 0;

        result.push({
            h: h,
            l:l
        });

        for (let i = 1; i < lengthOfArr; i++) {
            let num = arr[i];

            if (num < h) {
                if (num < l) {
                    l = num;
                    result[index].l = l;
                }

                let prevWasHigher = true;

                do {
                    if (index > 0 && result[index-1].h > l) {
                        index--;
                        result[index].h = h;
                        result[index].l = l;

                        result.pop();
                    } else {
                        prevWasHigher = false;
                    }
                } while (prevWasHigher);
            }
            else {
                result[index] = {
                    h:h,
                    l:l
                };

                h = num;
                l = num;

                result.push({
                    h: h,
                    l:l
                });

                index++;
            }
        }

        resultString += result.length + "\n";
    }

    console.log(resultString);
    //console.log(Date.now() - startTime + " ms");
}

"use strict";

//let startTime = Date.now();

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});

process.stdin.on("end", (_) => {
    inputString = inputString
        .trim()
        .split("\n")
        .map((string) => {
            return string.trim();
        });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
    const numOfTests = +(readline());

    for (let i=0; i<numOfTests; i++){
        const lengthOfArr = +(readline());
        const arr = readline().split(" ").map((string) => {
            return +(string);
        });

        let result = [];

        let h = arr[0];
        let l = arr[0];
        let index = 0;

        result.push({
            h: h,
            l:l
        });

        for (let i = 1; i < lengthOfArr; i++) {
            let num = arr[i];

            if (num < h) {
                if (num < l) {
                    l = num;
                    result[index].l = l;
                }

                let prevWasHigher = true;

                do {
                    if (index > 0 && result[index-1].h > l) {
                        index--;
                        result[index].h = h;
                        result[index].l = l;

                        result.pop();
                    } else {
                        prevWasHigher = false;
                    }
                } while (prevWasHigher);
            }
            else {
                result[index] = {
                    h:h,
                    l:l
                };

                h = num;
                l = num;

                result.push({
                    h: h,
                    l:l
                });

                index++;
            }
        }

        console.log(result.length);
    }

    //console.log(Date.now() - startTime + " ms");
}

const readline = require('readline');

const rl = readline.createInterface({
    // input: require('fs').createReadStream('input.txt'),
    input: process.stdin,
    output: process.stdout,
    crlfDelay: Infinity,
});

const it = rl[Symbol.asyncIterator]();

const main = async () => {
    let t = (await it.next()).value;
    while(t--)
    {
        let n = Number((await it.next()).value);
        let arr = (await it.next()).value.split(' ').map(x => Number(x))
        let el = 0;
        let count = 0;
        let rem = 0;
        arr.forEach(element => {

            if(element > el)
            {
                rem = rem + (element - el - 1);

                el = element;
            }else{
                rem--;
            }

            if(rem === 0)
            {
                count++;
            }

        })
        console.log(count);
    }

}
main();

const readline = require('readline');

const rl = readline.createInterface({
    // input: require('fs').createReadStream('input.txt'),
    input: process.stdin,
    output: process.stdout
    // removeHistoryDuplicates: true
});

const it = rl[Symbol.asyncIterator]();

const main = async () => {
    // let use_case;
    // while(true){use_case = await it.next();if(use_case.value !== '')break;}
    let t = (await it.next()).value;
    // let test_case = Number(t);
    let r_t= 1;
    while(t--)
    {
        let n;
        while(true){n = await it.next();if(n.value !== '')break;}
        // n = Number(n.value);
        let arr;
        while(true){arr = await it.next();if(arr.value !== '')break;}
        arr = arr.value.split(' ').map(x => Number(x))
        let el = 0;
        let count = 0;
        let rem = 0;
        arr.forEach(element => {

            if(element > el)
            {
                rem = rem + (element - el - 1);

                el = element;
            }else{
                rem--;
            }

            if(rem === 0)
            {
                count++;
            }

        })
        console.log(count);
        // r_t++;
    }

}
main();

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

const main = (data) => {
    data = data.split('\n');
    let t = Number(data[0])
    // let test_case = Number(t);
    let line=1;
    let r_t= 1;
    while(t--)
    {
        const n = Number(data[line]);
        line++;
        let i_arr = (data[line]);
        line++;
        let arr = i_arr.split(' ').map( x => Number(x));
        let el = 0;
        let count = 0;
        let rem = 0;

        arr.forEach(element => {

            if(element > el)
            {
                // count++;
                rem = rem + (element - el - 1);

                el = element;
            }else{
                rem--;
            }

            if(rem === 0)
            {
                count++;
            }

        })
        console.log(count);
        // }
        r_t++;
    }

}

'use strict';
 /*jslint node:true, browser:true, es6:true*/
const print = console.log
const E = {};
const lines = []
if (!process.env.JEST_WORKER_ID){
  const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
  rl.on('line', line => {
      lines.push(line);
  });
  rl.on('close', main)
}
let rli = 0;
function readline() {
    return lines[rli++];
}
const L = process.env.DEBUG ? console.log : ()=>{};

module.exports = E;
const ra = ()=>readline().split(' ').map(a=>+a)

class DSU {
  constructor(n){
    this.parents = new Array(n).fill(0);
    this.rank = new Array(n).fill(0);
    for (let i=0; i<n; i++)
      this.parents[i] = i;
  }
  get(x){
    if (this.parents[x]==x)
      return x;
    return this.parents[x] = this.get(this.parents[x]);
  }
  unite(x, y){
    x = this.get(x);
    y = this.get(y);
    if (x != y) {
      if (this.rank[x] < this.rank[y]){
        let tmp = x;
        x = y;
        y = tmp;
      }
      this.parents[y] = x;
      if (this.rank[x] == this.rank[y])
        this.rank[x]++;
    }
  }
}

class Heap {
  constructor(){
    this.root = null;
    this.count = 0;
  }
  size(){
    return this.count;
  }
  top(){
    return this.root.value;
  }
  push(value){
    this.root = HeapNode.merge(this.root, new HeapNode(value));
    this.count++;
  }
  pop(){
    if (!this.count)
      return null;
    this.count--;
    let val = this.root.value;
    this.root = HeapNode.merge(this.root.l, this.root.r);
    return val;
  }
}
// max heap
class HeapNode {
  constructor(value, l, r){
    this.value = value;
    this.l = l;
    this.r = r;
  }
  static merge(node1, node2){
    if (!node1)
      return node2;
    if (!node2)
      return node1;
    if (node1.value<node2.value)
      return HeapNode.merge(node2, node1);
    return Math.random()>0.5 ?
     new HeapNode(node1.value, node1.l, HeapNode.merge(node1.r, node2)) :
     new HeapNode(node1.value, HeapNode.merge(node1.l, node2), node1.r);
  }
}

const calc = (n, P)=>{
  let dsu = new DSU(n);
  let heap = new Heap();
  for (let i=0; i<n; i++){
    P[i]--;
    let el = P[i];
    let max = el;
    while (heap.size() && heap.top()>el){
      max = Math.max(max, heap.top());
      dsu.unite(heap.pop(), el);
    }
    heap.push(max);
  }
  let set = new Set();
  for (let i=0; i<n; i++)
    set.add(dsu.get(i))
  return set.size;
};

function main() {
    let T = +readline()
    while (T--){
      let [n] = ra();
      let A = ra();
      L('Ans:')
      print(calc(n, A));
    }
}

E.calc = calc;

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
	inputString += inputStdin;
});

process.stdin.on("end", () => {
	inputString = inputString
		.trim()
		.split("\n")
		.map((string) => {
			return string.trim();
		});

	main();
});

function readline() {
	return inputString[currentLine++];
}

function main() {
	const testCount = +readline();
	let resultString = "";

	for (let i = 0; i < testCount; i++) {
		let arrayLength = +readline();
		let perm = readline()
			.split(" ")
			.map((e) => +e);

		let result = 0;
		let biggest = perm.length;

		const indexLookup = {};
		perm.forEach((e, i) => {
			indexLookup[e] = i;
		});

		while (perm.length > 0) {
			let index = indexLookup[biggest];

			while (index >= perm.length) {
				biggest--;
				index = indexLookup[biggest];
			}

			let end = perm.splice(index);

			if (end.length === 1) {
				result++;
			} else {
				const smallest = end.reduce((small, element) => {
					return Math.min(small, element);
				}, Infinity);
				perm.push(smallest);
				indexLookup[smallest] = perm.length - 1;
			}
			biggest--;
		}

		resultString += result + "\n";
	}

	console.log(resultString);
}

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
	inputString += inputStdin;
});

process.stdin.on("end", () => {
	inputString = inputString
		.trim()
		.split("\n")
		.map((string) => {
			return string.trim();
		});

	main();
});

function readline() {
	return inputString[currentLine++];
}

function main() {
	const testCount = +readline();

	for (let i = 0; i < testCount; i++) {
		let arrayLength = +readline();
		let perm = readline()
			.split(" ")
			.map((e) => +e);

		let result = 0;
		let biggest = perm.length;

		const indexLookup = {};
		perm.forEach((e, i) => {
			indexLookup[e] = i;
		});

		while (perm.length > 0) {
			let index = indexLookup[biggest];

			while (index >= perm.length) {
				biggest--;
				index = indexLookup[biggest];
			}

			let end = perm.splice(index);

			if (end.length === 1) {
				result++;
			} else {
				const smallest = end.reduce((small, element) => {
					return Math.min(small, element);
				}, Infinity);
				perm.push(smallest);
				indexLookup[smallest] = perm.length - 1;
			}
			biggest--;
		}

		console.log(result);
	}
}

'use strict';

function solve(n, a) {
  const st = [n - 1];
  const uf = new UnionFind(n);
  for (let i = n - 2; i >= 0; i--) {
    if (a[i] > a[st[st.length - 1]]) {
      let t = st[st.length - 1];
      while (st.length && a[i] > a[st[st.length - 1]]) {
        const j = st.pop();
        uf.union(i, j);
      }
      st.push(t);
    }
    if (a[i] < a[st[st.length - 1]]) st.push(i);
  }
  const roots = new Set();
  for (let i = 0; i < n; i++) {
    roots.add(uf.find(i));
  }
  return roots.size;
}
class UnionFind {
  constructor(n) {
    this.p = [...new Array(n).keys()];
    this.find = this.find.bind(this);
    this.union = this.union.bind(this);
    this.isConnect = this.isConnect.bind(this);
  }
  find(i) {
    const {
      p
    } = this;
    while (p[i] !== i) {
      p[i] = p[p[i]];
      i = p[i];
    }
    return p[i];
  }
  union(i, j) {
    const {
      p,
      find
    } = this;
    const ri = find(i),
          rj = find(j);
    if (ri !== rj) p[rj] = ri;
  }
  isConnect(i, j) {
    const {
      find
    } = this;
    const ri = find(i),
          rj = find(j);
    return ri === rj;
  }
}

async function main(read) {
  try {
    let t = Number(await read());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      const n = Number(await read());
      const a = (await read()).split(' ').map(Number);
      res[i] = solve(n, a);
    }
    return res.join('\n');
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', async () => {
  inputs = str.split('\n').values();
  const output = await main(read);
  process.stdout.write(output);
});

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
function iInpArr1() {
  return readline()
    .trim()
    .split("")
    .map((cur) => parseInt(cur));
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    let max = -1,
      ans = 0;
    for (let i = 0; i < n; i++) {
      max = Math.max(arr[i], max);
      if (max === i + 1) ans++;
    }
    console.log(ans);
  }
};
solve();

var tests = parseInt(readline());

for (var i = 0; i < tests; i++) {
  var n = parseInt(readline());
  var arr = readline()
    .split(" ")
    .map((i) => parseInt(i));

  var el = arr[0];
  var min = el;
  var cuts = [];
  for (var j = 1; j < arr.length; j++) {
    min = Math.min(min, arr[j]);
    if (arr[j] > el) {
      cuts.push([min, el]);
      el = arr[j];
      min = el;
    }
  }
  cuts.push([min, el]);
  cuts.sort((a, b) => a[0] - b[0]);
  var sum = 1;
  var max = cuts[0][1];
  for (var j = 1; j < cuts.length; j++) {
    if (cuts[j][0] < max) max = Math.max(max, cuts[j][1]);
    else {
      sum++;
      max = cuts[j][1];
    }
  }
  print(sum);
}

"use strict";

//let startTime = Date.now();

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});

process.stdin.on("end", (_) => {
    inputString = inputString
        .trim()
        .split("\n")
        .map((string) => {
            return string.trim();
        });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
    const numOfTests = +(readline());

    for (let i=0; i<numOfTests; i++){
        const lengthOfArr = +(readline());
        const arr = readline().split(" ").map((string) => {
            return +(string);
        });

        let result = 0;

        let componentArr = [];
        let unusedComponentID = 0;

        for (let id = 0; id < lengthOfArr; id++) {
            componentArr[id] = undefined;
        }

        for (let i = 0; i < lengthOfArr; i++) {
            for (let j = lengthOfArr-1; j > 0; j--) {
                if (i < j && arr[i] > arr[j]) {
                    if (componentArr[i] === undefined && componentArr[j] === undefined) {
                        componentArr[i] = unusedComponentID;
                        componentArr[j] = unusedComponentID;
                        unusedComponentID++;
                    }
                    else if (componentArr[j] === undefined) {
                        componentArr[j] = componentArr[i];
                    }
                    else {
                        for (let n=j+1; n<lengthOfArr; n++) {
                            if (componentArr[n] === componentArr[i])
                            componentArr[n] = componentArr[j];
                        }
                        componentArr[i] = componentArr[j];
                    }
                }
            }
        }

        //console.debug(componentArr);

        for (let i = 0; i<lengthOfArr; i++) {
            if (componentArr[i] === undefined) {
                componentArr[i] = unusedComponentID;
                unusedComponentID++;
            }
            result = [... new Set(componentArr)].length;
        }

        console.log(result);
    }

//    console.log(Date.now() - startTime + " ms");
}

"use strict";

//let startTime = Date.now();

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});

process.stdin.on("end", (_) => {
    inputString = inputString
        .trim()
        .split("\n")
        .map((string) => {
            return string.trim();
        });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
    const numOfTests = +(readline());

    for (let i=0; i<numOfTests; i++){
        const lengthOfArr = +(readline());
        const arr = readline().split(" ").map((string) => {
            return +(string);
        });

        let result = 0;

        let componentArr = [];
        let unusedComponentID = 0;

        for (let id = 0; id < lengthOfArr; id++) {
            componentArr[id] = undefined;
        }

        for (let i = 0; i < lengthOfArr; i++) {
            for (let j = lengthOfArr-1; j > 0; j--) {
                if (i < j && arr[i] > arr[j]) {
                    if (componentArr[i] === undefined) {
                        componentArr[i] = unusedComponentID;
                        componentArr[j] = unusedComponentID;
                        unusedComponentID++;
                    }
                    else if (componentArr[j] === undefined) {
                        componentArr[j] = componentArr[i];
                    }
                    else {
                        for (let n=j+1; n<lengthOfArr; n++) {
                            if (componentArr[n] === componentArr[i])
                            componentArr[n] = componentArr[j];
                        }
                        componentArr[i] = componentArr[j];
                    }
                }
            }
        }

        for (let i = 0; i<lengthOfArr; i++) {
            if (componentArr[i] === undefined) {
                componentArr[i] = unusedComponentID;
                unusedComponentID++;
            }
            result = [... new Set(componentArr)].length;
        }

        console.log(result);
    }

//    console.log(Date.now() - startTime + " ms");
}

const readline = require('readline');

const rl = readline.createInterface({
    // input: require('fs').createReadStream('../input.txt')
    input: process.stdin,
    output: process.stdout
});

const it = rl[Symbol.asyncIterator]();

const main = async () => {
    const use_cases = await it.next();
    let t = use_cases.value;
    let test_case = Number(t);
    let r_t= 1;
    while(t--)
    {
        const n = Number((await it.next()).value);
        let arr = (await it.next()).value.split(' ').map( x => Number(x));
        let el = 0;
        let count = 0;
        let rem = 0;
        arr.forEach(element => {

            if(element > el)
            {
                // count++;
                rem = rem + (element - el - 1);

                el = element;
            }else{
                rem--;
            }

            if(rem === 0)
            {
                count++;
            }

        })
        // if(test_case === 100000)
        // {
        //     if(r_t === 10922)
        //     {
        //         console.log(arr);
        //     }
        // }else{
        console.log(count);
        // }
        r_t++;
    }

}
main();

const readline = require('readline');

const rl = readline.createInterface({
    // input: require('fs').createReadStream('../input.txt')
    input: process.stdin,
    output: process.stdout
});

const it = rl[Symbol.asyncIterator]();

const main = async () => {
    const use_cases = await it.next();
    let t = use_cases.value;
    let test_case = Number(t);
    let r_t= 1;
    while(t--)
    {
        const n = Number((await it.next()).value);
        let arr = (await it.next()).value.split(' ').map( x => Number(x));
        let el = 0;
        let count = 0;
        let rem = 0;
        arr.forEach(element => {

            if(element > el)
            {
                // count++;
                rem = rem + (element - el - 1);

                el = element;
            }else{
                rem--;
            }

            if(rem === 0)
            {
                count++;
            }

        })
        if(test_case === 100000)
        {
            if(r_t === 10922)
            {
                console.log(arr);
            }
        }else{
        console.log(count);
        }
        r_t++;
    }

}
main();

const readline = require('readline');

const rl = readline.createInterface({
    // input: require('fs').createReadStream('../input.txt')
    input: process.stdin,
    output: process.stdout
});

const it = rl[Symbol.asyncIterator]();

const main = async () => {
    const use_cases = await it.next();
    let t = use_cases.value;
    while(t--)
    {
        const n = Number((await it.next()).value);
        let arr = (await it.next()).value.split(' ').map( x => Number(x));
        let el = 0;
        let count = 0;
        let rem = 0;
        arr.forEach(element => {

            if(element > el)
            {
                // count++;
                rem = rem + (element - el - 1);

                el = element;
            }else{
                rem--;
            }

            if(rem === 0)
            {
                count++;
            }

        })
        console.log(count);
    }

}
main();

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
	inputString += inputStdin;
});

process.stdin.on("end", () => {
	inputString = inputString
		.trim()
		.split("\n")
		.map((string) => {
			return string.trim();
		});

	main();
});

function readline() {
	return inputString[currentLine++];
}

function main() {
	const testCount = +readline();

	for (let i = 0; i < testCount; i++) {
		let arrayLength = +readline();
		let perm = readline()
			.split(" ")
			.map((e) => +e);

		let n = 0;

		const graph = {};

		perm.forEach((value, index) => {
			graph[index] = { edges: [], index };
		});

		perm.forEach((value, i) => {
			perm.forEach((element, j) => {
				if (j > i && element < value) {
					graph[i].edges.push(j);
					graph[j].edges.push(i);
				}
			});
		});

		while (perm.length > 0) {
			let component = [graph[0]];
			let j = 0;
			while (component[j]) {
				const { edges } = component[j];
				edges.forEach((edge) => {
					if (component.indexOf(graph[edge]) === -1) {
						component.push(graph[edge]);
					}
				});
				j++;
			}
			n++;

			component = component.sort(({ index }, { index: index2 }) => {
				return index - index2;
			});

			for (let k = component.length - 1; k >= 0; k--) {
				let { index } = component[k];
				perm.splice(index, 1);
			}
		}

		console.log(n);
	}
}


Vasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has n buses and m trolleys, the buses are numbered by integers from 1 to n, the trolleys are numbered by integers from 1 to m.Public transport is not free. There are 4 types of tickets:   A ticket for one ride on some bus or trolley. It costs c1 burles;  A ticket for an unlimited number of rides on some bus or on some trolley. It costs c2 burles;  A ticket for an unlimited number of rides on all buses or all trolleys. It costs c3 burles;  A ticket for an unlimited number of rides on all buses and trolleys. It costs c4 burles. Vasya knows for sure the number of rides he is going to make and the transport he is going to use. He asked you for help to find the minimum sum of burles he will have to spend on the tickets.

The first line contains four integers c1, c2, c3, c4 (1 ≤ c1, c2, c3, c4 ≤ 1000) — the costs of the tickets. The second line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of buses and trolleys Vasya is going to use. The third line contains n integers ai (0 ≤ ai ≤ 1000) — the number of times Vasya is going to use the bus number i. The fourth line contains m integers bi (0 ≤ bi ≤ 1000) — the number of times Vasya is going to use the trolley number i.

Print a single number — the minimum sum of burles Vasya will have to spend on the tickets.

NoteIn the first sample the profitable strategy is to buy two tickets of the first type (for the first bus), one ticket of the second type (for the second bus) and one ticket of the third type (for all trolleys). It totals to (2·1) + 3 + 7 = 12 burles.In the second sample the profitable strategy is to buy one ticket of the fourth type.In the third sample the profitable strategy is to buy two tickets of the third type: for all buses and for all trolleys.

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var data = tokenizeIntegers(readline());
	var costs = {
		ticket: data[0],
		line: data[1],
		busesOrTrolleys: data[2],
		allLines: data[3] };

	readline();
	var busCounts = tokenizeIntegers(readline()),
		trolleyCounts = tokenizeIntegers(readline());

	var best = costs.allLines;
	best = Math.min(best, 2*costs.busesOrTrolleys);

	function bestCost(counts) {
		var total = 0;
		for (var countIndex = 0; countIndex < counts.length; ++countIndex) {
			total += Math.min(costs.line, counts[countIndex]*costs.ticket);
		}
		return total;
	}

	best = Math.min(best, costs.busesOrTrolleys +
			Math.min(bestCost(busCounts), bestCost(trolleyCounts)));
	best = Math.min(best, bestCost(busCounts) + bestCost(trolleyCounts));
	print(best);
}

main();

(function main() {
    var c = readline().split(' ').map(function(i){return parseInt(i);});
    var n = readline().split(' ').map(function(i){return parseInt(i);});
    var a = readline().split(' ').map(function(i){return Math.min(parseInt(i) * c[0], c[1]);});
    var b = readline().split(' ').map(function(i){return Math.min(parseInt(i) * c[0], c[1]);});
    var s0 = Math.min(a.reduce(function(a, b){return a + b;}), c[2]);
    var s1 = Math.min(b.reduce(function(a, b){return a + b;}), c[2]);
    print(Math.min(s0 + s1, c[3]));
})();