import java.io.*;
import java.util.*;

public class water_vd_slow {

	public void solve() throws IOException {
		int n = nextInt();
		int max = nextInt();
		int q = nextInt();
		int[] values = new int[n];
		for (int i = 0; i < n; i++) {
			values[i] = nextInt();
		}
		for (int i = 0; i < q; i++) {
			if (nextInt() == 1) {
				int l = nextInt() - 1;
				int r = nextInt() - 1;
				int val = nextInt();
				for (int j = l; j <= r; j++) {
					values[j] = Math.min(max, values[j] + val);
				}
			} else {
				long sum = 0;
				int l = nextInt() - 1;
				int r = nextInt() - 1;
				for (int j = l; j <= r; j++) {
					sum = sum + values[j];
				}
				out.println(sum);
			}
		}

	}

	final String fileName = "water_vd_".split("_")[0];

	public void run() throws IOException {
		br = new BufferedReader(new FileReader(fileName + ".in"));
		out = new PrintWriter(fileName + ".out");
		solve();
		out.close();
		br.close();
	}

	public static void main(String[] args) throws IOException {
		new water_vd_slow().run();
	}

	BufferedReader br;
	StringTokenizer str;
	PrintWriter out;

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

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

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

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

}