import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	final static String END_SIGN = "-";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		String str;
		while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		}

		for (String s : resultList) {
			System.out.println(s);
		}

	}

	static String Shuffle(String str, int num) {
		String result = str.substring(num);
		result += str.substring(0, num);
		return result;
	}

	// 終了判定
	public static boolean EndDecision(String array) {
		if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		}

	}

}
 import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

	final static String END_SIGN = "-";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		String str;
		while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		}

		for (String s : resultList) {
			System.out.println(s);
		}

	}

	static String Shuffle(String str, int num) {
		String result = str.substring(num);
		result += str.substring(0, num);
		return result;
	}

	// 終了判定
	public static boolean EndDecision(String array) {
		if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		}

	}

} Main final static String END_SIGN = "-"; END_SIGN "-" public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		String str;
		while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		}

		for (String s : resultList) {
			System.out.println(s);
		}

	} main {
		Scanner sc = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		String str;
		while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		}

		for (String s : resultList) {
			System.out.println(s);
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<String> resultList = new ArrayList<String>(); resultList new ArrayList<String>() String str; str while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		} EndDecision(str = sc.nextLine()) EndDecision str = sc.nextLine() str sc.nextLine() sc.nextLine sc {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		} int shuffleCount = Integer.parseInt(sc.nextLine()); shuffleCount Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			} int i = 0; int i = 0; i 0 i < shuffleCount i shuffleCount i++ i++ i {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			} {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			} str = Shuffle(str, Integer.parseInt(sc.nextLine())) str Shuffle(str, Integer.parseInt(sc.nextLine())) Shuffle str Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc resultList.add(str) resultList.add resultList str for (String s : resultList) {
			System.out.println(s);
		} String s resultList {
			System.out.println(s);
		} {
			System.out.println(s);
		} System.out.println(s) System.out.println System.out System System.out s String[] args args static String Shuffle(String str, int num) {
		String result = str.substring(num);
		result += str.substring(0, num);
		return result;
	} Shuffle {
		String result = str.substring(num);
		result += str.substring(0, num);
		return result;
	} String result = str.substring(num); result str.substring(num) str.substring str num result += str.substring(0, num) result str.substring(0, num) str.substring str 0 num return result; result String str str int num num // 終了判定
	public static boolean EndDecision(String array) {
		if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		}

	} EndDecision {
		if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		}

	} if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		} array.equals(END_SIGN) array.equals array END_SIGN {
			return false;
		} return false; false {
			return true;
		} return true; true String array array public class Main {

	final static String END_SIGN = "-";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		String str;
		while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		}

		for (String s : resultList) {
			System.out.println(s);
		}

	}

	static String Shuffle(String str, int num) {
		String result = str.substring(num);
		result += str.substring(0, num);
		return result;
	}

	// 終了判定
	public static boolean EndDecision(String array) {
		if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		}

	}

} public class Main {

	final static String END_SIGN = "-";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		String str;
		while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		}

		for (String s : resultList) {
			System.out.println(s);
		}

	}

	static String Shuffle(String str, int num) {
		String result = str.substring(num);
		result += str.substring(0, num);
		return result;
	}

	// 終了判定
	public static boolean EndDecision(String array) {
		if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		}

	}

} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	final static String END_SIGN = "-";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		String str;
		while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		}

		for (String s : resultList) {
			System.out.println(s);
		}

	}

	static String Shuffle(String str, int num) {
		String result = str.substring(num);
		result += str.substring(0, num);
		return result;
	}

	// 終了判定
	public static boolean EndDecision(String array) {
		if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		}

	}

}

