#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;

mt19937 mt(736);


/// Solves segment-sum problem using sqrt-decomposition
/// \tparam sz the size of the blocks
template<int sz>
class sqrt_decomposition
{
	static_assert(sz >= 1, "The size of the blocks should be positive");

	vector<int> val, blocks;

public:
	/// Constructor
	/// \param n the size
	explicit sqrt_decomposition(size_t n = 0) : val(n), blocks((n + sz - 1) / sz)
	{}

	/// Adds a value to the element in given position
	/// \param pos position where to add, 0-indexed
	/// \param x value to add
	void add(size_t pos, int x)
	{
		val[pos] += x;
		blocks[pos / sz] += x;
	}

	/// Computes the sum on the half-closed interval [l, r)
	/// \param l left endpoint, included, 0-indexed
	/// \param r right endpoint, excluded, 0-indexed
	/// \return the sum :)
	[[nodiscard]] int sum(size_t l, size_t r) const
	{
		int ans = 0;

		while (l < r && l % sz != 0)
			ans += val[l++];
		while (l < r && r % sz != 0)
			ans += val[--r];

		l /= sz;
		r /= sz;

		while (l < r)
			ans += blocks[l++];

		return ans;
	}
};

/// \param n
/// \return the smallest power of 2 not less than n
template<class T>
T up(const T &n)
{
	T r = 1;

	while (r < n)
		r *= 2;

	return r;
}

/// Solves segment-sum problem using segment tree
/// \tparam T the type of the summands
template<class T>
class segtree
{
	vector<T> arr;

public:
	/// Constructor
	/// \param n the size
	explicit segtree(size_t n = 0) : arr(2 * n) // : arr(2 * up(n))
	{}

	/// Adds a value to the element in given position
	/// \param pos position where to add, 0-indexed
	/// \param x value to add
	void add(size_t pos, const T &x)
	{
		pos += arr.size() / 2;

		while (pos > 0)
		{
			arr[pos] += x;
			pos /= 2;
		}
	}

	/// Computes the sum on the half-closed interval [l, r)
	/// \param l left endpoint, included, 0-indexed
	/// \param r right endpoint, excluded, 0-indexed
	/// \return the sum :)
	[[nodiscard]] T sum(size_t l, size_t r) const
	{
		l += arr.size() / 2;
		r += arr.size() / 2;

		/*
		 * `le, ri` are needed for non-commutative (but still associative!) operations
		 * for the case of simple sum `T ans = 0` is sufficient
		 *
		 * */
		T le{}, ri{};

		while (l < r)
		{
			if (l % 2 != 0)
				le = le + arr[l++];
			if (r % 2 != 0)
				ri = arr[--r] + ri;

			l /= 2;
			r /= 2;
		}

		return le + ri;
	}
};


void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int n, m; // the size and the number of queries

	cin >> n >> m;

	sqrt_decomposition<2> sq(n);
	segtree<int> st(n);

	for (int i = 0; i < m; i++)
	{
		char ch;

		cin >> ch;

		if (ch == '+')
		{
			int wh, x;

			cin >> wh >> x; // 1-indexed
			wh--;           // 0-indexed

			sq.add(wh, x);
			st.add(wh, x);
		}

		if (ch == '=')
		{
			int l, r;

			cin >> l >> r; // [l, r], 1-indexed
			l--;           // [l, r), 0-indexed

			cout << sq.sum(l, r) << '\t' << st.sum(l, r) << endl;
		}
	}
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	cout << fixed;

#ifdef LOCAL
	auto st = chrono::steady_clock::now();

	ifstream fin("../input.txt");

	do
	{
		solve(fin);

		cout << "===" << endl;

		string str;
		while (getline(fin, str) && str != string(max(1, (int) str.size()), '='));
	} while (fin);

	cout << setprecision((int) floor(log10(chrono::steady_clock::duration::period::den)));
	cout << "clock: " << chrono::duration<double>(chrono::steady_clock::now() - st).count() << endl;
#else
	solve();
#endif

	return 0;
}
