jiahuimbzuai/CoQuIR huggingface dataset:
//  [python]
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

A , B = list(map(int, sys.stdin.buffer.readline().split()))
print( int(A * B / gcd(A, B)))
//  [python]
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007
"""
#N,K,Mが入力
    n,k,m=LI() 
    #N
    #x1 y1
    #.  .
    #xn ynが入力
    N=I()
    p=LIR(N)
    print(n,k,m,p)
"""

import fractions
def lcm(a, b):
    #return a * b // gcd (a, b)
    return a * b // fractions.gcd (a, b)

def resolve():
    a,b=LI()
    ans=lcm(a,b)
    print(ans)

    return

import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2 3"""
        output = """6"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """123 456"""
        output = """18696"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """100000 99999"""
        output = """9999900000"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()
//  [python]
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict
from fractions import gcd
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	A, B = getlist()
	GCD = gcd(A, B)
	ans = int(A * B // GCD)
	print(ans)


if __name__ == '__main__':
	main()
//  [java]
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        Set<Integer> primeNumberSet = primeNumberSet(Math.max(a, b));
        Map<Integer, Integer> divisorSetA = getDivisorList(a, primeNumberSet);
        Map<Integer, Integer> divisorSetB = getDivisorList(b, primeNumberSet);
        divisorSetB.keySet().forEach(k -> divisorSetA.put(k, Math.max(divisorSetB.get(k), divisorSetA.getOrDefault(k, 0))));
        List<Integer> list = divisorSetA.keySet().stream().map(k -> (int) Math.pow(k, divisorSetA.get(k))).collect(Collectors.toList());
        System.out.println(list.stream().mapToLong(m -> m).reduce(1, (m, n) -> m * n));
    }

    static Map<Integer, Integer> getDivisorList(int n, Set<Integer> primeNumberSet) {
        return primeNumberSet.stream().filter(f -> f <= n).filter(m -> n % m == 0).collect(Collectors.toMap(m -> m, m -> count(n, m)));
    }

    static Set<Integer> primeNumberSet(int n) {
        if (n < 2) return new HashSet<>();
        return IntStream.rangeClosed(2, n).filter(Main::isPrimeNumber).boxed().collect(Collectors.toSet());
    }

    static boolean isPrimeNumber(int n) {
        if (n == 2) return true;
        if (n % 2 == 0) return false;
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }

    static int count(int m, int n) {
        int count = 0;
        while (m % n == 0) {
            m = m / n;
            count++;
        }
        return count;
    }
}
//  [java]
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        Set<Integer> primeNumberSet = primeNumberSet(Math.max(a, b));
        Map<Integer, Integer> divisorSetA = getDivisorList(a, primeNumberSet);
        Map<Integer, Integer> divisorSetB = getDivisorList(b, primeNumberSet);
        divisorSetB.keySet().forEach(k -> divisorSetA.put(k, Math.max(divisorSetB.get(k), divisorSetA.getOrDefault(k, 0))));
        List<Integer> list = divisorSetA.keySet().stream().map(k -> (int) Math.pow(k, divisorSetA.get(k))).collect(Collectors.toList());
        long n = 1;
        for (int num : list) {
            n = n * num;
        }
        System.out.println(n);
    }

    static Map<Integer, Integer> getDivisorList(int n, Set<Integer> primeNumberSet) {
        return primeNumberSet.stream().filter(f -> f <= n).filter(m -> n % m == 0).collect(Collectors.toMap(m -> m, m -> count(n, m)));
    }

    static Set<Integer> primeNumberSet(int n) {
        if (n < 2) return new HashSet<>();
        return IntStream.rangeClosed(2, n).filter(Main::isPrimeNumber).boxed().collect(Collectors.toSet());
    }

    static boolean isPrimeNumber(int n) {
        if (n == 2) return true;
        if (n % 2 == 0) return false;
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }

    static int count(int m, int n) {
        int count = 0;
        while (m % n == 0) {
            m = m / n;
            count++;
        }
        return count;
    }
}
//  [java]

import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long[] items = Stream.of(sc.nextLine().split(" ", 0)).mapToLong(Long::parseLong).toArray();
		sc.close();
		Main main = new Main();
		if (items[0] > items[1]) {
			long let = items[0];
			items[0] = items[1];
			items[1] = let;
		}
		long ans = items[0] / main.GCD(items[0], items[1]) * items[1];
		System.out.println(ans);
	}

	public long GCD(long num1, long num2) {
		if (num2 == 0) {
			return num1;
		} else {
			return GCD(num2, num1 % num2);
		}
	}


}
//  [cpp]
#include <cstdint>
#include <algorithm>
#include <iostream>
#include <list>
#include <vector>

bool is_sosuu(uint32_t v)
{
    if ( v <= 2 ) return true;
    for ( uint32_t _v = 2; _v < v; _v++ ) {
        if ( v % _v == 0 ) return false;
    }
    return true;
}

void calc_sosuu(std::vector<uint64_t> &s, uint64_t max)
{
    for ( uint64_t v = 2; v <= max; v++ ) {
        if ( is_sosuu(v) ) s.emplace_back(v);
    }
}

void get_soinsuu(uint64_t val, const std::vector<uint64_t> &sosuu, std::vector<std::pair<uint64_t, uint64_t>> &insuu)
{
    for ( auto ss : sosuu ) {
        uint64_t cnt = 0;
        uint64_t sss = ss;
        while ( val % sss == 0 ) {
            cnt++;
            sss *= ss;
        }
        if ( cnt == 0 ) continue;
        insuu.emplace_back(std::make_pair(ss, cnt));        
    }
    return;
}


void mondai_c()
{
    uint64_t a,b;
    std::cin >> a >> b;

    std::vector<uint64_t> sosuu;
    calc_sosuu(sosuu, std::max(a,b));

    std::vector<std::pair<uint64_t, uint64_t>> insuu_a;
    std::vector<std::pair<uint64_t, uint64_t>> insuu_b;

    get_soinsuu(a, sosuu, insuu_a);
    get_soinsuu(b, sosuu, insuu_b);

    // 乗数が0より大きい場合、大きい方の値のペアを全部掛ける
    uint64_t min_a = a, min_b = b;
    uint64_t r = 1;
    for ( auto ia = insuu_a.cbegin(); ia != insuu_a.cend(); ia++ ) {
        uint64_t ib_a = std::get<0>(*ia);
        bool isok = false;
        for ( auto ib = insuu_b.cbegin(); ib != insuu_b.cend(); ib++ ) {
            uint64_t ib_b = std::get<0>(*ib);
            if ( ib_a == ib_b ) {
                uint64_t e = std::max(std::get<1>(*ia), std::get<1>(*ib));
                uint64_t rr = ib_a;
                while ( e > 1 ) {
                    rr *= ib_a;
                    e--;
                }
                r *= rr;
                isok = true;
                insuu_b.erase(ib);
                break;
            }
        }
        if ( isok ) continue;
        // 見つからない
        uint64_t e = std::get<1>(*ia);
        uint64_t rr = ib_a;
        while ( e > 1 ) {
            rr *= ib_a;
            e--;
        }
        r *= rr;
    }
    for ( auto ib = insuu_b.cbegin(); ib != insuu_b.cend(); ib++ ) {
        uint64_t e = std::get<1>(*ib);
        uint64_t ib_b = std::get<0>(*ib);
        uint64_t rr = ib_b;
        while ( e > 1 ) {
            rr *= ib_b;
            e--;
        }
        r *= rr;
    }

    std::cout << r;
}

int main()
{
    mondai_c();

    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
  ll a,b;
  cin >> a >> b;
  
  if(a < b){
    int tmp = a;
    a = b;
    b = tmp;
  }
  
  ll ans = 0;
  for(ll i = 1; ; i++){
    ans = a * i;
    for(ll j = 1; b*j <= ans; j++){
      if(b * j == ans){
        cout << ans << endl;
        return 0;
      }
    }
  }
  
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
int times(int x, int y){
  int cnt=0;
  while(x%y==0){
    cnt++;
    x /= y;
  }
  return cnt;
}
int64_t mult(int xx, int yy){
  int z = 1;
  while(yy>0){
    z *= xx;
    yy -= 1;
  }
  return z;
}
int xxx(int z){
  for(int i=2; i<z; i++){
    if(z%i==0) return 0;
  }
  return 1;
}
int main() {
  int a, b;
  cin >> a >> b;
  int aa[110000];
  int bb[110000];
  for(int i=1; i<=110000; i++){
    aa[i] = 0;
    bb[i] = 0;
  }
  for(int i=2; i<=100000; i++){
    aa[i] += times(a, i);
    bb[i] += times(b, i);
  }
  
  int64_t sum = 1;
  for(int i=2; i<=100000; i++){
    int maxx = 0;
    if(xxx(i)){
      if(aa[i]>=1 || bb[i]>=1){
        maxx = max(aa[i], bb[i]);
      }
      sum *= mult(i, maxx);
    }
  }
  cout << sum << endl;
  
}
//  [c]
#include <stdio.h>

int max(int p0,int p1){
  return(p0>p1?p0:p1);
}
int main(){
  long a,m;
  int i,j,l[2][100000],np,p[100000];
  p[0]=2;
  np=1;
  for(i=3;i<100000;i+=2){
    for(j=1;j<np;j++){
      if(i%p[j]==0) break;
    }
    if(j==np){
      p[np]=i;
      np++;
    }
  }
  for(i=0;i<2;i++){
    scanf("%ld",&a);
    for(j=0;j<np;j++){
      l[i][j]=0;
      while(a%p[j]==0){
        a/=p[j];
        l[i][j]++;
      }
    }
  }
  m=1;
  for(i=0;i<np;i++){
    for(j=max(l[0][i],l[1][i]);j>0;j--){
      m*=(long)p[i];
    }
  }
  printf("%ld",m);
  return(0);
}
//  [c]
#include<stdio.h>
int main(void){
  long int A,B;
  scanf("%ld %ld",&A,&B);
  long int i;
  long int j;
  if(A>=B){for(i=B;;i--){if(A%i==0&&B%i==0){break;}}
    printf("%ld",A*B/i);}
  if(B>A){for(j=A;;j--){if(A%j==0&&B%j==0){break;}}
    printf("%ld",A*B/j);} return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
/*小文字判定
if((moji>= 'a') && (moji<='z')){
    printf("a\n");
    return 0;
  }
  */

int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(int *a, int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	long long int a,b,L,j,n,m=0,i,prime[10000],prime_num[100000]={0},a_prime[100005]={0},b_prime[100005]={0},num=1;

scanf("%lld%lld",&a,&b);
  L=a;
  if(b>a){
    L=b;
  }
  for(i=2;i<=L;i++){
  if(prime_num[i]==2){
    
  continue;
  }
    prime_num[i]=1;
    //printf("2_%lld\n",i);
     m++;
    prime[m]=i;
   
    for(j=2;j*i<=L;j++){
    prime_num[j*i]=2;
    }
  }
  
  for(i=1;i<=m&&a!=0;i++){
    while(a!=0){
      
    if(a%prime[i]==0){
    a_prime[i]++;
      a=a/prime[i];
      //printf("a is %lld now\n",a);
    }
     else{ 
       break;
     }
    }
  }

  for(i=1;i<=m&&b!=0;i++){
    while(b!=0){
      
    if(b%prime[i]==0){
    b_prime[i]++;
      b=b/prime[i];
      //printf("b is %lld now\n",b);
    }
      else{
      break;
      }
    }
  }
  
  for(i=1;i<=m;i++){
    if(a_prime[i]!=0||b_prime[i]!=0){
    if(a_prime[i]>b_prime[i]){
      //printf("a%lld=>%lld\n",prime[i],a_prime[i]);
    for(j=0;j<a_prime[i];j++){
    num=num*prime[i];
      
    }
    }
      else{
        //printf("b%lld=>%lld\n",prime[i],b_prime[i]);
      for(j=0;j<b_prime[i];j++){
    num=num*prime[i];
        if(num>100000){
        //printf("%lld\n",num);
        }
    }
      }
    }

  }
  //printf("%lld\n",a_prime[1]);
	printf("%lld",num);
return 0;
}
//  [javascript]
"use strict";
    
function getGcm(x, y) {
  x = Math.abs(x);
  y = Math.abs(y);
  while (y) {
    let t = y;
    y = x % y;
    x = t;
  }
  return x;
}

function getLcm(x, y) {
  return (!x || !y) ? 0 : Math.abs((x * y) / getGcm(x, y));
}

const main = arg => {
    arg = arg.trim().split("\n");
    
    const A = parseInt(arg[0].split(" ")[0]);
    const B = parseInt(arg[0].split(" ")[1]);
    
    console.log(getLcm(A, B));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]

function gcd(a, b){
    if(b != 0)
        return gcd(b, a%b);
    else
        return a;
}

function lcm(a, b){
    return a * b / gcd(a, b);
}

function Main(arg) {
 
    var A = arg.split(" ")[0]-0;
    var B = arg.split(" ")[1]-0;

    var ans = lcm(A, B);
         
    console.log(ans);

    return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
    input[0] = input[0].split(" ");
	var a = parseInt(input[0][0], 10);
  	var aft = a;
    var b = parseInt(input[0][1], 10);
    var bft = b;
  	var aso = new Array(100000);
    var bso = new Array(100000);
    var ans = 1;
    aso[0] = 0;
    aso[1] = 0;
    bso[0] = 0;
    bso[1] = 0;
	for(var i=2; i<=100000; i++){
      aso[i] = 0;
      bso[i] = 0;
      for(var j=0; j<1; j){
        if(a%i == 0){
           a = a/i;
           aso[i] += 1;
        }else{
           j = 1;
        }
      }
      for(var j=0; j<1; j){
        if(b%i == 0){
           b = b/i;
           bso[i] += 1;
        }else{
           j = 1;
        }
      }
    }
  for(var i=2; i<=100000; i++){
    if(aso[i] != 0 && bso[i] != 0){
      for(var j=0; j<Math.max(aso[i], bso[i]); j++){
        ans *= i;
      }
  }else if(aso[i] != 0){
      for(var j=0; j<aso[i]; j++){
        ans *= i;
      }
  }else if(bso[i] != 0){
      for(var j=0; j<bso[i]; j++){
        ans *= i;
      }
  }
  }
  /*
  var max = 0;
  if(max < ans){
    max = ans;
  }
  if(max < aft){
     max = aft;
  }
  if(max < bft){
    max = bft;
  }
  */
  console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	In := readLineInt()
	A, B := In[0], In[1]
	AMap, BMap := map[int]int{}, map[int]int{}
	End := max(A, B)
	for prime := 2; prime <= End; prime++ {
		isPrime := true
		for p := 2; p < sqrt(prime); p++ {
			if (prime % p) == 0 {
				isPrime = false
				break
			}
		}

		if isPrime {
			p, c := multiplier(A, prime)
			if c != -1 {
				A /= p
				AMap[prime] = c
			}

			p, c = multiplier(B, prime)
			if c != -1 {
				B /= p
				BMap[prime] = c
			}
		}

		if A == 1 && B == 1 {
			break
		}

		if prime != 2 {
			prime++
		}
	}

	Max := AMap
	for k, v := range BMap {
		mv := Max[k]
		Max[k] = max(mv, v)
	}

	result := 1
	for k, v := range Max {
		result *= pow(k, v)
	}
	fmt.Println(result)
}

func multiplier(value int, prime int) (int, int) {
	now, previous, count := 1, 0, 1
	for {
		now = now * prime
		if value%now != 0 {
			if previous != 0 {
				value = value / previous
				return previous, count - 1
			}
			break
		} else {
			previous = now
		}
		count++
	}
	return -1, -1
}

/////////////////////////////////////////
func readLineInt() []int {
	result := make([]int, 0)
	for _, v := range strings.Split(readLine(), " ") {
		i, _ := strconv.Atoi(v)
		result = append(result, i)
	}
	return result
}

var reader = bufio.NewReaderSize(os.Stdin, 1e6)

func readLine() string {
	result := make([]byte, 0, 1e6)
	for {
		line, remains, e := reader.ReadLine()
		if e != nil {
			panic(e)
		}
		result = append(result, line...)
		if !remains {
			break
		}
	}
	return string(result)
}

func Loop(start, end int, f func(i int)) {
	for i := start; i < end; i++ {
		f(i)
	}
}

func pow(a, b int) int {
	result := a
	Loop(0, b-1, func(i int) {
		result = result * a
	})

	return result
}

func max(a ...int) int {
	result := 0

	for _, i := range a {
		if result < i {
			result = i
		}
	}

	return result
}

func sqrt(a int) int {
	return int(math.Sqrt(float64(a)))
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func gcdiv(a, b int) int {
	big := max(a, b)
	small := min(a, b)
	if small == 0 {
		return big
	}
	return gcdiv(big-small, small)
}

func main() {
	A := readint()
	B := readint()
	gcd := gcdiv(A, B)
	ans := A * B / gcd
	fmt.Println(ans)
}

const (
	iobufsize = 1 * 1024 * 1024 // 1 MB
)

var stdinsc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, iobufsize), iobufsize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func readint() int {
	stdinsc.Scan()
	v, err := strconv.Atoi(stdinsc.Text())
	if err != nil {
		panic(err)
	}
	return v
}

func readstr() string {
	stdinsc.Scan()
	return stdinsc.Text()
}

func pow(x, y int) int {
	if y < 1 {
		return 1
	}
	return x * pow(x, y-1)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

const (
	BUFSIZE   = 10000000
	MOD       = 1000000007
	INF_INT   = math.MaxInt32
	INF_INT64 = math.MaxInt64
)

var rdr *bufio.Reader

func main() {
	rdr = bufio.NewReaderSize(os.Stdin, BUFSIZE)
	solve()
}

func solve() {
	var A, B int
	fmt.Scanf("%d %d", &A, &B)
	fmt.Println(gcd(A, B))
}

func readline() string {
	buf := make([]byte, 0, BUFSIZE)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			fmt.Println(e.Error())
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func readIntSlice(size int) []int {
	slice := make([]int, size)
	lines := strings.Split(readline(), " ")
	for i, v := range lines {
		slice[i] = s2i(v)
	}
	return slice
}

func readInt64Slice(size int) []int64 {
	slice := make([]int64, size)
	lines := strings.Split(readline(), " ")
	for i, v := range lines {
		slice[i] = s2i64(v)
	}
	return slice
}

func readint() int {
	return s2i(readline())
}

func readint64() int64 {
	return s2i64(readline())
}

// For int64
func b2i64(b bool) int64 {
	if b {
		return 1
	}
	return 0
}

func abs64(v int64) int64 {
	if v < 0 {
		return -v
	}
	return v
}

func min64(values ...int64) int64 {
	ret := int64(INF_INT64)
	for _, v := range values {
		if ret > v {
			ret = v
		}
	}
	return ret
}

func max64(values ...int64) int64 {
	ret := -int64(INF_INT64)
	for _, v := range values {
		if ret < v {
			ret = v
		}
	}
	return ret
}

func s2i64(s string) int64 {
	v, ok := strconv.ParseInt(s, 10, 64)
	if ok != nil {
		panic("Faild : " + s + " can't convert to int64")
	}
	return v
}

// For int
func b2i(b bool) int {
	if b {
		return 1
	}
	return 0
}

func abs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}

func min(values ...int) int {
	ret := INF_INT
	for _, v := range values {
		if ret > v {
			ret = v
		}
	}
	return ret
}

func max(values ...int) int {
	ret := -INF_INT
	for _, v := range values {
		if ret < v {
			ret = v
		}
	}
	return ret
}

func s2i(s string) int {
	v, ok := strconv.Atoi(s)
	if ok != nil {
		panic("Faild : " + s + " can't convert to int")
	}
	return v
}

func lcm(v1, v2 int) int {
	if v1 > v2 {
		v1, v2 = v2, v1
	}
	for v1 != 0 {
		v1, v2 = v2%v1, v1
	}
	return v2
}

func gcd(v1, v2 int) int {
	return v1 * v2 / lcm(v1, v2)
}

/* ------------------------------------------------ */
/* Data stracture                                   */
/* ------------------------------------------------ */
type IntHeap []int

func (h *IntHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }
//  [ruby]
require 'prime'
ans=1
a,b=gets.split.map &:to_i
aa=a.prime_division << [Float::INFINITY]
bb=b.prime_division << [Float::INFINITY]
la=aa.size
lb=bb.size
ea,eb=aa.each,bb.each
pa=ea.next
pb=eb.next
(la+lb).times do
  break if pa[0]==Float::INFINITY&&pb[0]==Float::INFINITY
  if pa[0]==pb[0]
    ans*=pa[0]**[pa[1],pb[1]].max
    pa=ea.next
    pb=eb.next
  elsif pa[0] > pb[0]
    ans*=pb[0]**pb[1]
    pb=eb.next
  else
    ans*=pa[0]**pa[1]
    pa=ea.next
  end
end
p ans
//  [ruby]
A, B = gets.chomp.split.map(&:to_i)

A.times do |i|
  temp = B * (i+1)
  if (temp % A).zero?
    p temp
    exit
  end
end
//  [ruby]
a,b=gets.split.map &:to_i
m=[a,b].max
(1..).each do |i|
  break if m*i > a*b
  if m*i % [a,b].min==0
    p m*i
    break
  end
end
//  [rust]
use text_io::*;
use std::process::exit;
use im_rc::HashMap;
use std::cmp::min;

fn main(){
    let mut a:usize = read!();
    let mut b:usize = read!();
    let mut c:usize = 1;
    for mut i in 2..a+b {
        while a%i == 0 && b%i == 0{
            c*=i;
            a/=i;
            b/=i;
        }
    }
    println!("{}",a*b*c);
}
//  [rust]
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

pub fn gcd<T: PrimInt>(a: T, b: T) -> T {
    if b == zero()  {
        a
    } else {
        gcd(b, a % b)
    }
}

pub fn lcm<T: PrimInt>(a: T, b: T) -> T {
    a / gcd(a, b) * b
}

#[fastout]
fn main() {
    input!{
        a: usize, b: usize,
    }
    println!("{}", lcm(a, b));
}
//  [swift]
import Foundation
//最大公約数を求める関数
func gcd(_ num1: Int, _ num2: Int) -> Int {
   let r = num1 % num2
   if r != 0 {
       return gcd(num2, r)
   } else {
       return num2
   }
}
//３つ以上の数の最大公約数を求める
func gcdArr(_ numArr: [Int]) -> Int {
    var ans: Int = numArr[0]
    for i in numArr {
        ans = gcd(ans, i)
    }
    return ans
}

//最小公倍数を求める関数
func lcm(_ num1: Int, _ num2: Int) -> Int {
    
    var gcdNum = gcd(num1, num2)
    return num1*num2/gcdNum
}

let rdInt = readLine()!.split(separator: " ").map({Int($0)!})
let a = rdInt[0]
let b = rdInt[1]
print(lcm(a, b))
//  [swift]
// 🐋💭 Next Prime
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

func main() {
    let ab = readInts()
    let (a, b) = (ab[0], ab[1])
    let gcdValue = gcd(a, b)
    print(gcdValue * (a / gcdValue) * (b / gcdValue))
}
main()
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync("/dev/stdin", "utf8").split(" ");

const [a, b] = input;

console.log(lcm(+a, +b))

function lcm(a, b) {
  var g = (n, m) => m ? g(m, n % m) : n
  return a * b / g(a, b)
}
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ');

const gcd = (a: number, b: number): number => {
  if (b === 0) {
    return a;
  }
  return gcd(b, a % b);
};

const lcm = (a: number, b: number): number => {
  return (a / gcd(a, b)) * b;
};

const res: number = lcm(+input[0], +input[1]);

console.log(res);
//  [typescript]
function Main(input) {
	const lines = input.split('\n');
	let [a, b] = lines[0].split(' ').map(v => v*1).sort((a, b) {
		if (a < b) return 1;
		if (a > b) return -1;
		return 0;
	});
	const x = a * b;
	let r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	console.log(x/b);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353


x = I()
if x >= 30:
    print("Yes")
else:
    print("No")
//  [python]
from math import *
from collections import *
from random import *
from bisect import *
import sys
input=sys.stdin.readline
def lis():
    return list(map(int,input().split()))
def ma():
    return map(int,input().split())
def inp():
    return int(input())
x=inp()
s='No'
if(x>=30):
    s='Yes'
print(s)
//  [python]
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    X = int(input())
    if X >= 30:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()
//  [java]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        if(n<30){
            System.out.println("No");
        }else
            System.out.println("Yes");

    }
}
//  [java]
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var x = sc.nextInt();
		sc.close();

		System.out.println(x >= 30 ? "Yes" : "No");
	}
}
//  [java]
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int x = Integer.parseInt(sc.next());
    pw.println(x >= 30 ? "Yes" : "No");
  }
}
//  [cpp]
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    vector<int> v(250000000,0);
    int X;
    cin >> X;
    if (X >= 30) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
//  [cpp]
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    vector<int> v(100000000,0);
    int X;
    cin >> X;
    if (X >= 30) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
struct Interval{ll start,end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}

vll divisors[10000001];
int main(){
	fio;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ll n;
	cin>>n;
	if(n>=30){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}
//  [c]
#include<stdio.h>

int main()
{
    int x;
    scanf("%d", &x);
    if(x < 30) {
        printf("No\n");
    }
    else {
        printf("Yes\n");
    }
    return 0;
}
//  [c]
#include<stdio.h>

int main(void){
  
  int x;
  
  scanf("%d", &x);
  if(x >= 30){
    printf("Yes");
  }else{
    printf("No");
  }
  
  return 0;
}
//  [c]
#include <stdio.h>

int main(void){
  int x;
  scanf("%d", &x);
  
  if (x >= 30){
    printf("Yes");
  } else {
    printf("No");
  }
  
  return 0;
}
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);

    console.log(N >= 30 ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var X = parseInt(input[0]);
  var ans = "Yes";
  if(X<30){
    ans = "No";
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	fmt.Println(abc174a(os.Stdin))
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func abc174a(r io.Reader) string {
	sc := bufio.NewScanner(r)
	sc.Split(bufio.ScanWords)

	x := nextInt(sc)

	if x < 30 {
		return "No"
	}

	return "Yes"
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func main() {
	n := readInt()
	if n >= 30 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readInt() int {
	return int(readInt64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
x = gets.chomp.to_i

if x >= 30
  puts 'Yes'
else
  puts 'No'
end
//  [ruby]
require 'pp'

x = gets.to_i
if x >= 30
    puts "Yes"
else
    puts "No"
end
//  [ruby]
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end
x = gets_i

if x >= 30
  puts "Yes"
else
  puts "No"
end
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    print(readInt() >= 30 ? "Yes": "No")
}
main()
//  [swift]
let input=readLine()!
let deg = Int(input)!
if(deg >= 30){
  print("Yes")
}
else{
print("No")
}
//  [typescript]
import { readFileSync } from 'fs'
import { reverse } from 'dns'
import { start } from 'repl'
 
let lines: string[] = [];
const reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
 
reader.on('line', function (line: string) {
    lines.push(line);
});
reader.on('close', function () {
    let n = parseInt(lines[0])
    /* let l = lines[1].split(' ').map(function (_) { return parseInt(_); }) */

    if(n >= 30) {
        console.log('Yes')
    } else {
        console.log('No')
    }
});
//  [typescript]
{
  const lines = [];
  const reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
  });

  reader.on('line', function (line) {
    lines.push(line);
  });
  reader.on('close', function () {
    const number = lines[0];
    const res = lines[0] >= 30 ? 'Yes' : 'No';
    console.log(res);
  });
}
//  [typescript]
// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const [N] = r.nn()

    return N >= 30 ? 'Yes' : 'No'
  }

  const _io = (i = 0) => {
    const str: string = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}
//  [python]
MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)

n,m,q = map(int,input().split())
cond = [[] for _ in range(n)]
abcd = [tuple(map(int,input().split())) for _ in range(q)]
for a,b,c,d in abcd:
    a -= 1
    b -= 1
    cond[b].append((a,c,d))       

ans = 0
def dfs(i,before,score):
    global ans
    if i == n - 1:
        ans = max(ans,score)
        return
    for num in range(before[i],m + 1):
        point = 0
        for a,c,d in cond[i + 1]:
            if num - before[a] == c:
                point += d
        if point > 0:
            before[i + 1] = num
            dfs(i + 1,before,score + point)
    before[i + 1] = before[i]
    dfs(i + 1,before,score) 

dfs(0,[1] + [-1]*(n - 1),0)
print(ans)
//  [python]
N, M, Q = map(int, input().split())
X=[0]*Q
for i in range(Q):
    X[i] = list(map(int, input().split()))
from itertools import combinations_with_replacement
def solve(N,M,Q,X):
    ans = 0
    for c in combinations_with_replacement(range(1,M+1), N-1):
        A = [1]+list(c)
        score = 0
        for x in X:
            if A[x[1]-1]-A[x[0]-1]==x[2]:
                score += x[3]
        ans = max(ans,score)
    return ans
print(solve(N,M,Q,X))
//  [python]
n, m , q = map(int, input().split())
 
l = []
for i in range(q):
  a,b,c,d = map(int, input().split())
  l.append((a,b,c,d))
max_score = 0
comb = [[1]]
while len(comb) > 0:
  seed = comb.pop()
  if len(seed) == n:
    score = 0
    for j in l:
      if seed[j[1]-1]-seed[j[0]-1]==j[2]:
      
        score += j[3]
    if score > max_score:
      max_score = score
  else:
    for k in range(seed[-1], m+1):
      s = seed[:]
      s.append(k)
      comb.append(s)
print(max_score)
//  [python]
import itertools
N,M,Q = map(int, input().split())
L = [list(map(int, input().split())) for i in range(Q)]
ans = 0
for A in itertools.combinations_with_replacement([i for i in range(1,M+1)],N):
    sorted(A)
    pre_ans = 0
    for i in range(Q):
        a,b,c,d = L[i]
        if A[b-1] - A[a-1] == c:
            pre_ans += d
        ans = max(ans,pre_ans)
print(ans)
//  [python]
import itertools
N, M, Q = map(int, input().split())

K= [list(map(int, input().split())) for i in range(Q)]#二次配列

ans = 0
for A in itertools.combinations_with_replacement([i for i in range(1, M + 1)], N):
    ans1 = 0
    for i in range(Q):
        a, b, c, d = K[i]#各数字に配列の値を代入する
        if (A[b - 1] - A[a - 1] == c):
            ans1 += d
        ans = max(ans, ans1)
print(ans)
//  [python]
import itertools as it
n,m,q=map(int, input().split())
x=[list(map(int, input().split())) for i in range(q)]
a,ans = [],0
for i in range(1,m+1):
    a.append(i)
b = list(it.combinations_with_replacement(a, n))
for i in range(0,len(b)):
    c = 0
    for j in range(0,len(x)):
        d,e,f = x[j][0],x[j][1],x[j][2]
        if b[i][e-1] - b[i][d-1] == f:
            c += x[j][3]
    if c > ans:
        ans = c
print(ans)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.*;

import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOfRange;
import static java.util.Arrays.sort;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 998244353;

    int[] a,b,c,d,x;
    int n,m,q;
    int ans = 0;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        n = in.nextInt();
        m = in.nextInt();
        q = in.nextInt();
        a = new int[q];
        b = new int[q];
        c = new int[q];
        d = new int[q];
        x = new int[n];
        for (int i = 0; i < q; i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
            c[i] = in.nextInt();
            d[i] = in.nextInt();
        }
        dfs(0, 1,0);
        out.println(ans);
    }

    private void dfs(int t, int v, int sum) {
        if (t == n) {
            ans = Math.max(ans, sum);
            return;
        }
        for (int i = v; i <= m; i++) {
            x[t] = i;
            int nsum = sum;
            for (int j = 0; j < q; j++) if (b[j] == t + 1 && x[t] - x[a[j] - 1] == c[j]) {
                nsum += d[j];
            }
            dfs(t + 1, i, nsum);
        }
    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

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

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

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

}
//  [java]

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();//Aの長さ
		int m=sc.nextInt();//Aの最大値
		int q=sc.nextInt();//abcdの長さ
		
		int[]a=new int[q];
		int[]b=new int[q];
		int[]c=new int[q];
		int[]d=new int[q];
		
		for(int i=0;i<q;i++){
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
			c[i]=sc.nextInt();
			d[i]=sc.nextInt();
		}
		
		int[]k=new int[n];
		
		/*if(q==1)System.out.println(d[0]);
		else */System.out.println(dfs(k, 0, 1,a,b,c,d,0,m));
		
	}
	
	static int dfs(int[] k, int index, int start,int[] a,int[] b,int[]c, int[]d, int max, int m){
		if(index==k.length){
			int tmp=0;
			for(int i=0;i<a.length;i++){
				if(k[b[i]-1]-k[a[i]-1]==c[i])tmp+=d[i];
			}
			
			if(tmp>max)max=tmp;
			
			return max;
		}
		
		for(int i=index;i<k.length;i++){
			
			for(int j=start;j<=m;j++){
				//System.out.print(index);
				k[index]=j;start=j;
				max=Math.max(dfs(k, index+1, start,a,b,c,d,max, m),max);
				
			}
		}
		return max;
		
		
	}
	
}
//  [java]
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int M = scan.nextInt();
			char[]n = new char[N];
			char[]m = new char[M-1];
			Arrays.fill(n, '0');
			Arrays.fill(m, '1');
			String s = new String(n);
			String k = new String(m);
			String x = s+k;
			
			int Q = scan.nextInt();
			int[]a = new int[Q];
			int[]b = new int[Q];
			int[]c = new int[Q];
			int[]d = new int[Q];
			for(int i = 0;i<Q;i++) {
				a[i] = scan.nextInt();
				b[i] = scan.nextInt();
				c[i] = scan.nextInt();
				d[i] = scan.nextInt();
			}
			
			long max = 0;
			
			
			 while (true) {
			  //System.out.println(x);
				 int[]A = new int[N]; 
			  int count = 1;
			  int l = 0;
			  for(int i = 0;i<N+M-1;i++) {
				  char g = x.charAt(i);
				  if(g=='0') {
					  A[l] = count;
					  l++;
				  }else{
					  count++;
				  }
			  }
			  
			  for(int i = 0;i<N;i++) {
				 // System.out.print(A[i]);
				  //System.out.print(" ");
			  }
			  //System.out.println();
			  
			  long souwa = 0;
			  for(int i = 0;i<Q;i++) {
				  int o = A[b[i]-1]-A[a[i]-1];
				  if(o==c[i])souwa+=d[i];
			  }
			  
			  if(max<souwa)max = souwa;
			  
	
			  x = nextPermutation(x);
			  if (x.equals("Final")) break;
			  }
			 
			 System.out.println(max);
			
			
			
			
			
			
			
			
			
		}
		
		
	}
	
	
	//与えられた文字の種類と文字数を元に、初めの文字から順番に文字列を出力するメソッド
	//区別されているものを、順番に並べる通りを全列挙、、、、順列を順番に列挙(N種類ならN個の文字列になる必要がある。)
	//区別されていないもを、順番に並べる通りを全列挙,,,,,,組み合わせを順番に列挙になる。nCkなら０ｎ個１k個という順番でスターと。
	
	
	private static String nextPermutation (String s) {
		/*入力した文字列(数列、英語小文字、英語大文字)の次の順番を返すメソッド
		 * String s = "ABC";
		 * while (true) {
		 * System.out.println(s);
		 * s = nextPermutation(s);
		 * if (s.equals("Final")) break;
		 * }
		 * とmainメソッド に書けばN文字の文字列をN!文小さい物から順に列挙することができる*/

		ArrayList<Character> list = new ArrayList<>();
		for (int i=0; i<s.length(); i++) list.add(s.charAt(i));

		int pivotPos = -1;
		char pivot = 0;
		for (int i=list.size()-2; i>=0; i--) {
			if (list.get(i) < list.get(i+1)) {
				pivotPos = i;
				pivot = list.get(i);
				break;
			}
		}

		if (pivotPos==-1 && pivot==0) return "Final";

		int L = pivotPos+1, R = list.size()-1;
		int minPos = -1;
		char min = Character.MAX_VALUE;
		for (int i=R; i>=L; i--) {
			if (pivot < list.get(i)) {
				if (list.get(i) < min) {
					min = list.get(i);
					minPos = i;
				}
			}
		}

		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));

		StringBuilder sb = new StringBuilder();
		for (int i=0; i<list.size(); i++) sb.append(list.get(i));

		return sb.toString();

	}
	
	
	
	
		
	}