#!/bin/python def all_palindromes(string): return len(string) def shift(char,dist): return chr(((ord(char)-97 + dist) % 26)+97) import sys n,q = raw_input().strip().split(' ') n,q = [int(n),int(q)] s = raw_input().strip() for a0 in xrange(q): query = raw_input().strip().split(' ') if (int(query[0]) == 1): start = int(query[1]) end = int(query[2]) d = int(query[3]) new_s = s[0:start] for i in range(start,end+1): new_s = new_s + shift(s[i],d) s = new_s + s[end+1:] else: start = int(query[1]) end = int(query[2]) print all_palindromes(s[start:end+1])